mirror of https://github.com/kiwix/libkiwix.git
This commit is contained in:
parent
faff227365
commit
4b545b8ae2
|
@ -125,3 +125,14 @@ bool copyFile(const string &sourcePath, const string &destPath) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string getExecutablePath() {
|
||||||
|
char binRootPath[PATH_MAX];
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#else
|
||||||
|
readlink("/proc/self/exe", binRootPath, PATH_MAX);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return std::string(binRootPath);
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <ios>
|
#include <ios>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
@ -46,5 +47,6 @@ bool fileExists(const string &path);
|
||||||
bool makeDirectory(const string &path);
|
bool makeDirectory(const string &path);
|
||||||
bool copyFile(const string &sourcePath, const string &destPath);
|
bool copyFile(const string &sourcePath, const string &destPath);
|
||||||
string getLastPathElement(const string &path);
|
string getLastPathElement(const string &path);
|
||||||
|
string getExecutablePath();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue