From: rnv Date: Wed, 19 Jun 2019 12:27:06 +0000 (+0300) Subject: Compilation on Windows. X-Git-Tag: EMC2P_V1_1_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=96068bdd6fbafcb2ce632e8214485329deda16e8;p=modules%2Fkernel.git Compilation on Windows. --- diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 608fda19d..7e2f7c6c9 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -1404,7 +1404,11 @@ long SALOME_ContainerManager::SystemWithPIDThreadSafe(const std::vector +#else +#include +#include +#endif #include #include #include #include +#include constexpr char NAME_IN_NS[]="/ExternalServers"; @@ -55,8 +61,23 @@ SALOME_ExternalServerLauncher::~SALOME_ExternalServerLauncher() class ChdirRAII { public: +#ifndef WIN32 ChdirRAII(const std::string& wd):_wd(wd) { if(_wd.empty()) return ; char *pwd(get_current_dir_name()); _od = pwd; free(pwd); chdir(_wd.c_str()); } ~ChdirRAII() { if(_od.empty()) return ; chdir(_od.c_str()); } +#else + ChdirRAII(const std::string& wd) : _wd(wd) { + if (_wd.empty()) + return; + TCHAR pwd[MAX_PATH]; + GetCurrentDirectory(sizeof(pwd), pwd); + _od = Kernel_Utils::utf8_encode_s(pwd); + SetCurrentDirectory(Kernel_Utils::utf8_decode_s(_wd).c_str()); + } + ~ChdirRAII() { + if (_od.empty()) return; + SetCurrentDirectory(Kernel_Utils::utf8_decode_s(_od).c_str()); + } +#endif private: std::string _wd; std::string _od;