]> SALOME platform Git repositories - modules/kernel.git/blobdiff - src/Launcher/Launcher_Job.cxx
Salome HOME
Compilation under Windows: add missing header
[modules/kernel.git] / src / Launcher / Launcher_Job.cxx
index cbe54ef9797becbedbabfe260898cdfecc735c35..01cbbc99e77e2eff6b42e1af1aece3bb6b788e1b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2017  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
@@ -22,6 +22,9 @@
 //#define _DEBUG_
 #include "Launcher_Job.hxx"
 #include "Launcher.hxx"
+
+#include <Basics_DirUtils.hxx>
+
 #include <boost/filesystem.hpp>
 
 #ifdef WITH_LIBBATCH
@@ -31,6 +34,7 @@
 #include <sstream>
 #ifdef WIN32
   static const char SEPARATOR = '\\';
+#include <process.h>
 #else
   static const char SEPARATOR = '/';
 #endif
@@ -605,7 +609,8 @@ Launcher::Job::common_job_params()
 
   params[Batch::NAME] = getJobName();
   params[Batch::NBPROC] = _resource_required_params.nb_proc;
-  params[Batch::NBPROCPERNODE] = _resource_required_params.nb_proc_per_node;
+  if(_resource_required_params.nb_proc_per_node > 0)
+    params[Batch::NBPROCPERNODE] = _resource_required_params.nb_proc_per_node;
 
   if(_resource_required_params.nb_node > 0)
     params[Batch::NBNODE] = _resource_required_params.nb_node;
@@ -631,7 +636,11 @@ Launcher::Job::common_job_params()
     {
       std::string date_dir = std::string("/job_") + date;
       std::ostringstream str_pid;
+#ifdef WIN32
+         str_pid << _getpid();
+#else
       str_pid << ::getpid();
+#endif
       std::string job_dir = date_dir + "-" + str_pid.str();
 
       _work_directory = _resource_definition.working_directory + job_dir;
@@ -661,11 +670,8 @@ Launcher::Job::common_job_params()
 
   // If result_directory is not defined, we use HOME environment
   if (_result_directory == "")
-#ifndef WIN32
-    _result_directory = getenv("HOME");
-#else
-    _result_directory = getenv("USERPROFILE");
-#endif
+    _result_directory = Kernel_Utils::HomePath();
+
   // _in_files
   std::list<std::string> in_files(_in_files);
   in_files.push_back(_job_file);