-// 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
//#define _DEBUG_
#include "Launcher_Job.hxx"
#include "Launcher.hxx"
+
+#include <Basics_DirUtils.hxx>
+
#include <boost/filesystem.hpp>
#ifdef WITH_LIBBATCH
#include <sstream>
#ifdef WIN32
static const char SEPARATOR = '\\';
+#include <process.h>
#else
static const char SEPARATOR = '/';
#endif
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;
{
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;
// 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);