From cb7f594cea9015e986cafdeccf43b22742bf405e Mon Sep 17 00:00:00 2001 From: Maximilien Siavelis Date: Sun, 9 Feb 2020 12:55:57 +0100 Subject: [PATCH] Adaptations for Windows Signed-off-by: Ovidiu Mircescu --- CMakeModules/libbatchMacros.cmake | 2 +- src/Core/CommunicationProtocol.cxx | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeModules/libbatchMacros.cmake b/CMakeModules/libbatchMacros.cmake index 9ac4d2f..e23e873 100644 --- a/CMakeModules/libbatchMacros.cmake +++ b/CMakeModules/libbatchMacros.cmake @@ -60,7 +60,7 @@ MACRO(LIBBATCH_FIND_ALL_LOCAL_COMMANDS) FIND_LOCAL_COMMAND_WIN32_DEF(LIBBATCH_RM_COMMAND rm del) FIND_LOCAL_COMMAND(LIBBATCH_SH_COMMAND sh cmd.exe) FIND_LOCAL_COMMAND_WIN32_DEF(LIBBATCH_CP_COMMAND cp copy) - FIND_LOCAL_COMMAND_WIN32_DEF(LIBBATCH_MKDIR_COMMAND mkdir mkdir) + FIND_LOCAL_COMMAND_WIN32_DEF(LIBBATCH_MKDIR_COMMAND mkdir md) FIND_LOCAL_COMMAND(LIBBATCH_RSH_COMMAND rsh rsh) FIND_LOCAL_COMMAND(LIBBATCH_RCP_COMMAND rcp rcp) FIND_LOCAL_COMMAND(LIBBATCH_SSH_COMMAND ssh plink) diff --git a/src/Core/CommunicationProtocol.cxx b/src/Core/CommunicationProtocol.cxx index 0087063..aaee92b 100644 --- a/src/Core/CommunicationProtocol.cxx +++ b/src/Core/CommunicationProtocol.cxx @@ -123,17 +123,29 @@ namespace Batch { string CommunicationProtocol::getRemoveSubCommand(const string & path) const { +#ifdef WIN32 + return string("del /s ") + path; +#else return string("rm ") + path; +#endif } string CommunicationProtocol::getRemoveDirectorySubCommand(const string & path) const { +#ifdef WIN32 + return string("rd /s /q ") + path; +#else return string("rm -fR ") + path; +#endif } string CommunicationProtocol::getMakeDirectorySubCommand(const string & path) const { +#ifdef WIN32 + return string("md ") + path; +#else return string("mkdir -p ") + path; +#endif } int CommunicationProtocol::removeFile(const std::string & path, -- 2.39.2