Salome HOME
Fix for the "21727: [CEA 584] sending a Yacs graph from Windows to a cluster " issue.
[modules/kernel.git] / src / Launcher / Launcher_Job.cxx
index 5728af45ee5a2a62bcca60bd9b12e4db4c18e7c7..1307fbf2274d056c6e57c67214c623024126cddf 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2009-2012  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
@@ -205,9 +205,6 @@ Launcher::Job::setJobFile(const std::string & job_file)
   std::string::size_type p2 = _job_file.find_last_of(".");
   _job_file_name_complete = _job_file.substr(p1+1);
   _job_file_name = _job_file.substr(p1+1,p2-p1-1);
-
-  if (_job_file != "")
-    add_in_file(_job_file);
 }
 
 std::string
@@ -219,8 +216,6 @@ void
 Launcher::Job::setEnvFile(const std::string & env_file)
 {
   _env_file = env_file;
-  if (_env_file != "")
-    add_in_file(_env_file);
 }
 
 std::string
@@ -344,6 +339,9 @@ Launcher::Job::checkMaximumDuration(const std::string & maximum_duration)
   std::size_t pos = edt_value.find(":");
 
   if (edt_value != "") {
+    if (pos == edt_value.npos) {
+      throw LauncherException("[Launcher::Job::checkMaximumDuration] Error on definition: " + edt_value);
+    }
     std::string begin_edt_value = edt_value.substr(0, pos);
     std::string mid_edt_value = edt_value.substr(pos, 1);
     std::string end_edt_value = edt_value.substr(pos + 1, edt_value.npos);
@@ -491,7 +489,11 @@ Launcher::Job::common_job_params()
     _result_directory = getenv("HOME");
 
   // _in_files
-  for(std::list<std::string>::iterator it = _in_files.begin(); it != _in_files.end(); it++)
+  std::list<std::string> in_files(_in_files);
+  in_files.push_back(_job_file);
+  if (_env_file != "")
+         in_files.push_back(_env_file);
+  for(std::list<std::string>::iterator it = in_files.begin(); it != in_files.end(); it++)
   {
     std::string file = *it;
 
@@ -500,9 +502,13 @@ Launcher::Job::common_job_params()
     if (file.substr(0, 1) == std::string("/"))
       local_file = file;
     else
+#ifndef WIN32
       local_file = _local_directory + "/" + file;
+#else
+         local_file = file;
+#endif
     
-    // remote file -> get only file name from _in_files
+    // remote file -> get only file name from in_files
     size_t found = file.find_last_of("/");
     std::string remote_file = _work_directory + "/" + file.substr(found+1);