Skip to content

Commit

Permalink
.desktop: fix application file path
Browse files Browse the repository at this point in the history
  • Loading branch information
tobtoht committed Nov 28, 2023
1 parent 204cdde commit a73d715
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/utils/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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){
Expand Down
1 change: 1 addition & 0 deletions src/utils/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a73d715

Please sign in to comment.