mirror of
https://github.com/kiwix/libkiwix.git
synced 2026-10-23 17:39:16 -04:00
[ABI Break] Correctly detect the executable path in appimage.
There are two executable path : - The user one (the appimage path) - The real one (in the appimage archive) When we search of `library.xml` we need the user one. But when we search of `aria2c` or `kiwix-serve` we need the real one. Fix kiwix/kiwix-desktop#256
This commit is contained in:
1 parent
15d5b4ed58
commit
9b4419f3fc
4 files changed
+12
-16
No files matched your search
+9
-13
@@ -279,24 +279,20 @@ bool copyFile(const std::string& sourcePath, const std::string& destPath)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string getExecutablePath()
|
||||
std::string getExecutablePath(bool realPathOnly)
|
||||
{
|
||||
char binRootPath[PATH_MAX];
|
||||
|
||||
char* cAppImage = ::getenv("APPIMAGE");
|
||||
if (cAppImage) {
|
||||
char* cArgv0 = ::getenv("ARGV0");
|
||||
char* cOwd = ::getenv("OWD");
|
||||
if (!cArgv0 && !cOwd) {
|
||||
// Nothing to clean, goto in the same function...
|
||||
// This is silly but .. ok..
|
||||
// And we should pass here, if APPIMAGE is set ARGV0 and OWD should also
|
||||
// (except if there is a bug in appimage)
|
||||
goto normal;
|
||||
if (!realPathOnly) {
|
||||
char* cAppImage = ::getenv("APPIMAGE");
|
||||
if (cAppImage) {
|
||||
char* cArgv0 = ::getenv("ARGV0");
|
||||
char* cOwd = ::getenv("OWD");
|
||||
if (cArgv0 && cOwd) {
|
||||
return appendToDirectory(cOwd, cArgv0);
|
||||
}
|
||||
}
|
||||
return appendToDirectory(cOwd, cArgv0);
|
||||
}
|
||||
normal:
|
||||
|
||||
#ifdef _WIN32
|
||||
GetModuleFileName(NULL, binRootPath, PATH_MAX);
|
||||
|
||||
Reference in new issue
Block a user