]> SALOME platform Git repositories - modules/kernel.git/blobdiff - src/Launcher/Launcher_Job_CommandSALOME.cxx
Salome HOME
Compilation under Windows: add missing header
[modules/kernel.git] / src / Launcher / Launcher_Job_CommandSALOME.cxx
index 59db9e09f5d00d96c2daeaf2fb22d23fd64b7493..f38bb75586da6fb6bc8898c8500b96329ea6710f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2019  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2009-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -26,6 +26,7 @@
 #endif
 
 #include <sstream>
+#include <sys/stat.h>
 
 const char Launcher::Job_CommandSALOME::TYPE_NAME[] = "command_salome";
 
@@ -42,9 +43,17 @@ Launcher::Job_CommandSALOME::~Job_CommandSALOME() {}
 std::string Launcher::Job_CommandSALOME::runCommandString()
 {
   std::ostringstream result;
-  result << _resource_definition.AppliPath
-         << "/salome shell ./"
-         << _job_file_name_complete;
+  struct stat statbuf;
+  if(stat(getenv("APPLI"), &statbuf) ==0 &&  S_ISREG(statbuf.st_mode))
+      // case of a salome launcher file
+      result << _resource_definition.AppliPath
+             << " shell ./"
+             << _job_file_name_complete;
+  else
+      // case of a salome appli dir
+      result << _resource_definition.AppliPath
+             << "/salome shell ./"
+             << _job_file_name_complete;
   return result.str();
 }
 #endif