fix linux appPath

This commit is contained in:
Andrei Yankovich 2019-01-27 20:14:06 +03:00
parent b87e4491cd
commit 1619356261

View File

@ -13,6 +13,7 @@
#include "windows.h" #include "windows.h"
#else #else
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#endif #endif
using namespace QuasarAppUtils; using namespace QuasarAppUtils;
@ -38,7 +39,9 @@ bool Params::parseParams(int argc, char *argv[]) {
GetModuleFileNameA(nullptr, buffer, MAX_PATH); GetModuleFileNameA(nullptr, buffer, MAX_PATH);
params ["appPath"] = QFileInfo(buffer).absolutePath(); params ["appPath"] = QFileInfo(buffer).absolutePath();
#else #else
params ["appPath"] = QFileInfo(argv[0]).absolutePath(); char path[2048];
readlink("/proc/self/exe", path, 2048);
params ["appPath"] = QFileInfo(path).absolutePath();
#endif #endif
if (!getStrArg("appPath").size()) { if (!getStrArg("appPath").size()) {