Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@nextcloud.com>2020-12-21 14:15:54 +0300
committerGitHub <noreply@github.com>2020-12-21 14:15:54 +0300
commite1b0e3474f1fc175c4b95c6db11324c98d67cea3 (patch)
treea60904f8ab7d97449cb5300449a5b72caa57050d
parent1d265c791b47ff73b531bdbb1348b52f6dbc00df (diff)
parent98077abfba58cf9ee0f612c1bf41b19a0f33cd01 (diff)
Merge pull request #2753 from nextcloud/backport/2739/stable-3.1
[stable-3.1] Fixed the autostart for AppImages. See #2504.
-rw-r--r--src/common/utility_unix.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/common/utility_unix.cpp b/src/common/utility_unix.cpp
index 3ae4d671e..dbe285ba5 100644
--- a/src/common/utility_unix.cpp
+++ b/src/common/utility_unix.cpp
@@ -18,6 +18,7 @@
*/
#include <QStandardPaths>
+#include <QtGlobal>
namespace OCC {
@@ -71,12 +72,18 @@ void setLaunchOnStartup_private(const QString &appName, const QString &guiName,
qCWarning(lcUtility) << "Could not write auto start entry" << desktopFileLocation;
return;
}
+ // When running inside an AppImage, we need to set the path to the
+ // AppImage instead of the path to the executable
+ const QString appImagePath = qEnvironmentVariable("APPIMAGE");
+ const bool runningInsideAppImage = !appImagePath.isNull() && QFile::exists(appImagePath);
+ const QString executablePath = runningInsideAppImage ? appImagePath : QCoreApplication::applicationFilePath();
+
QTextStream ts(&iniFile);
ts.setCodec("UTF-8");
ts << QLatin1String("[Desktop Entry]") << endl
<< QLatin1String("Name=") << guiName << endl
<< QLatin1String("GenericName=") << QLatin1String("File Synchronizer") << endl
- << QLatin1String("Exec=") << QCoreApplication::applicationFilePath() << " --background" << endl
+ << QLatin1String("Exec=\"") << executablePath << "\" --background" << endl
<< QLatin1String("Terminal=") << "false" << endl
<< QLatin1String("Icon=") << APPLICATION_ICON_NAME << endl
<< QLatin1String("Categories=") << QLatin1String("Network") << endl