Salome HOME
Windows compatibility.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 2 Mar 2018 15:14:45 +0000 (16:14 +0100)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 2 Mar 2018 15:14:45 +0000 (16:14 +0100)
src/Core/Utils.cxx
src/Local/BatchManager_Local.cxx

index b7371f905b6e3acb041b7ff3936db28ec790f83e..3a17dd117561dcf82db1188a523910373e8a8d5a 100644 (file)
@@ -119,10 +119,9 @@ string Utils::createAndOpenTemporaryFile(const string & prefix, ofstream & outpu
   if (tmpDirName == NULL) tmpDirName = getenv("TMPDIR");
   if (tmpDirName == NULL) tmpDirName = "/tmp";
 
-  string fileName = (string)tmpDirName + "/libbatch-" + prefix + "-XXXXXX";
-
 #ifdef WIN32
 
+  string fileName = (string)tmpDirName + "\\libbatch-" + prefix + "-XXXXXX";
   char randstr[7];
   srand(time(NULL));
 
@@ -135,7 +134,7 @@ string Utils::createAndOpenTemporaryFile(const string & prefix, ofstream & outpu
   outputStream.open(fileName.c_str(), ios_base::binary | ios_base::out);
 
 #else
-
+  string fileName = (string)tmpDirName + "/libbatch-" + prefix + "-XXXXXX";
   char * buf = new char[fileName.size()+1];
   fileName.copy(buf, fileName.size());
   buf[fileName.size()] = '\0';
index f913ee653f93fdc5d8b99d4222856b739c25ff7c..c2c85e0f564cc4e9697ad54295821c86b8b28281 100644 (file)
@@ -263,12 +263,16 @@ namespace Batch {
       fileToExecute = param[EXECUTABLE].str();
     else
       throw RunTimeException("param[EXECUTABLE] is not defined. Please define it, cannot submit this job.");
-
-    string::size_type p1 = fileToExecute.find_last_of("/");
+#ifdef WIN32
+    const char separator = '\\';
+#else
+    const char separator = '/';
+#endif
+    string::size_type p1 = fileToExecute.find_last_of(separator);
     string::size_type p2 = fileToExecute.find_last_of(".");
     string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
     string fileNameToExecute = fileToExecute.substr(p1+1);
-    string remotePath = workDir + "/" + rootNameToExecute + "_launch_job";
+    string remotePath = workDir + separator + rootNameToExecute + "_launch_job";
 
     // Create batch submit file
     ofstream tempOutputFile;