Browse Source

fix(appimage): Use external binary path when enabling autorun from appimage

Fix #6241
reviewable/pr6382/r2
Anthony Bilinski 4 years ago
parent
commit
da5c165f41
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 18
      src/platform/autorun_xdg.cpp

18
src/platform/autorun_xdg.cpp

@ -38,9 +38,21 @@ QString getAutostartFilePath(QString dir) @@ -38,9 +38,21 @@ QString getAutostartFilePath(QString dir)
return dir + "/qTox - " + Settings::getInstance().getCurrentProfile() + ".desktop";
}
inline QString currentCommandLine()
QString currentBinPath()
{
return "\"" + QApplication::applicationFilePath() + "\" -p \""
const auto env = QProcessEnvironment::systemEnvironment();
const auto appImageEnvKey = QStringLiteral("APPIMAGE");
if (env.contains(appImageEnvKey)) {
return env.value(appImageEnvKey);
} else {
return QApplication::applicationFilePath();
}
}
inline QString profileRunCommand()
{
return "\"" + currentBinPath() + "\" -p \""
+ Settings::getInstance().getCurrentProfile() + "\"";
}
}
@ -56,7 +68,7 @@ bool Platform::setAutorun(bool on) @@ -56,7 +68,7 @@ bool Platform::setAutorun(bool on)
desktop.write("Type=Application\n");
desktop.write("Name=qTox\n");
desktop.write("Exec=");
desktop.write(currentCommandLine().toUtf8());
desktop.write(profileRunCommand().toUtf8());
desktop.write("\n");
desktop.close();
return true;

Loading…
Cancel
Save