+ std::string remoteapplipath;
+ if (applipath=="")
+ remoteapplipath = GetenvThreadSafeAsString("APPLI");
+ else
+ remoteapplipath = applipath;
+
+ ASSERT(GetenvThreadSafe("NSHOST"));
+ ASSERT(GetenvThreadSafe("NSPORT"));
+
+ // $APPLI points either to an application directory, or to a salome launcher file
+ // we prepare the remote command according to the case
+ struct stat statbuf;
+ if (stat(GetenvThreadSafe("APPLI"), &statbuf) ==0 && S_ISREG(statbuf.st_mode))
+ {
+ // if $APPLI is a regular file, we asume it's a salome Launcher
+ // generate a command with a salome launcher
+ command << remoteapplipath
+ << " remote"
+ << " -m "
+ << GetenvThreadSafeAsString("NSHOST") // hostname of CORBA name server
+ << " -p "
+ << GetenvThreadSafeAsString("NSPORT"); // port of CORBA name server
+ if (workdir != "")
+ command << "-d " << workdir;
+ command << " -- " ;
+ }
+ else // we assume it's a salome application directory
+ {
+ // generate a command with runRemote.sh
+ command << remoteapplipath;
+ command << "/runRemote.sh ";
+ command << GetenvThreadSafeAsString("NSHOST"); // hostname of CORBA name server
+ command << " ";
+ command << GetenvThreadSafeAsString("NSPORT"); // port of CORBA name server
+ if(workdir != "")
+ {
+ command << " WORKINGDIR ";
+ command << " '";
+ if(workdir == "$TEMPDIR")
+ command << "\\$TEMPDIR";
+ else
+ command << workdir; // requested working directory
+ command << "'";
+ }
+ }
+