mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-28 05:49:35 +00:00
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user