From a73d715b723505fa24f8bdf91a0b2442d4f1a12c Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 28 Nov 2023 01:34:35 +0100 Subject: [PATCH] .desktop: fix application file path --- src/utils/Utils.cpp | 11 ++++++++++- src/utils/Utils.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/utils/Utils.cpp b/src/utils/Utils.cpp index 51545dde..f942d03c 100644 --- a/src/utils/Utils.cpp +++ b/src/utils/Utils.cpp @@ -202,6 +202,15 @@ QString applicationPath() { return applicationPath; } +QString applicationFilePath() { + QString appimagePath = qgetenv("APPIMAGE"); + if (!appimagePath.isEmpty()) { + return appimagePath; + } + + return QApplication::applicationFilePath(); +} + bool validateJSON(const QByteArray &blob) { QJsonDocument doc = QJsonDocument::fromJson(blob); QString jsonString = doc.toJson(QJsonDocument::Indented); @@ -267,7 +276,7 @@ QString xdgDesktopEntry(){ "Icon=feather\n" "Categories=Network;GNOME;Qt;\n" "StartupNotify=false\n" - ).arg(QApplication::applicationFilePath()); + ).arg(applicationFilePath()); } bool xdgDesktopEntryWrite(const QString &path){ diff --git a/src/utils/Utils.h b/src/utils/Utils.h index 93632465..b43b450c 100644 --- a/src/utils/Utils.h +++ b/src/utils/Utils.h @@ -53,6 +53,7 @@ namespace Utils bool dirExists(const QString &path); QString defaultWalletDir(); QString applicationPath(); + QString applicationFilePath(); bool validateJSON(const QByteArray &blob); bool readJsonFile(QIODevice &device, QSettings::SettingsMap &map);