From d3a813c5b1d3facf160198544877ed3f3da05f34 Mon Sep 17 00:00:00 2001 From: xaedes Date: Fri, 3 Feb 2017 14:05:56 +0100 Subject: [PATCH] Fix issue #33 by adding a conditional code block for mingw platform, that calls the correct mkdir function. --- core/lib/FileDirProc/FileUtils.hpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/core/lib/FileDirProc/FileUtils.hpp b/core/lib/FileDirProc/FileUtils.hpp index f30219d6a..22ea1b2da 100644 --- a/core/lib/FileDirProc/FileUtils.hpp +++ b/core/lib/FileDirProc/FileUtils.hpp @@ -96,7 +96,28 @@ namespace gpstk _mkdir(path.c_str()); return 0; } -#else +#elif defined(__MINGW32__) || defined(__MINGW64__) + inline int makeDir(const std::string& path, unsigned mode) + { + // #ifdef __sun + // mkdirp(path.c_str(), mode); + // #else + std::string::size_type i = 0; + + while ((i = path.find('/',i+1)) != std::string::npos) + { + std::string thispath(path.substr(0,i)); + if (thispath[thispath.length() - 1] == '/') + thispath.erase(thispath.length() - 1); + + mkdir(thispath.c_str()); + + } + mkdir(path.c_str()); + // #endif + return 0; + } +#else inline int makeDir(const std::string& path, unsigned mode) { // #ifdef __sun