diff --git a/src/common/pathTools.cpp b/src/common/pathTools.cpp index 7e7f4bd05..a01934ca3 100644 --- a/src/common/pathTools.cpp +++ b/src/common/pathTools.cpp @@ -25,6 +25,8 @@ #elif _WIN32 #include #include "Shlwapi.h" +#include +#define getcwd _getcwd // stupid MSFT "deprecation" warning #endif #ifdef _WIN32 @@ -36,6 +38,7 @@ #define SEPARATOR "\\" #else #define SEPARATOR "/" +#include #endif #ifndef PATH_MAX @@ -238,3 +241,10 @@ bool writeTextFile(const string &path, const string &content) { file.close(); return true; } + +string getCurrentDirectory() { + char* a_cwd = getcwd(NULL,0); + string s_cwd(a_cwd); + free(a_cwd); + return s_cwd; +} diff --git a/src/common/pathTools.h b/src/common/pathTools.h index 783179b0e..7dc5f8cdc 100644 --- a/src/common/pathTools.h +++ b/src/common/pathTools.h @@ -55,6 +55,6 @@ bool makeDirectory(const string &path); bool copyFile(const string &sourcePath, const string &destPath); string getLastPathElement(const string &path); string getExecutablePath(); - +string getCurrentDirectory(); bool writeTextFile(const string &path, const string &content); #endif