mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(appimage): Use external binary path when enabling autorun from appimage
Fix #6241
This commit is contained in:
parent
5852d61914
commit
da5c165f41
|
@ -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)
|
|||
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…
Reference in New Issue
Block a user