This commit is contained in:
kelson42 2011-12-12 14:49:49 +00:00
parent faff227365
commit 4b545b8ae2
2 changed files with 13 additions and 0 deletions

View File

@ -125,3 +125,14 @@ bool copyFile(const string &sourcePath, const string &destPath) {
return true;
}
string getExecutablePath() {
char binRootPath[PATH_MAX];
#ifdef _WIN32
#else
readlink("/proc/self/exe", binRootPath, PATH_MAX);
#endif
return std::string(binRootPath);
}

View File

@ -29,6 +29,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <ios>
#include <limits.h>
#ifdef _WIN32
#include <direct.h>
@ -46,5 +47,6 @@ bool fileExists(const string &path);
bool makeDirectory(const string &path);
bool copyFile(const string &sourcePath, const string &destPath);
string getLastPathElement(const string &path);
string getExecutablePath();
#endif