diff options
author | Itay Grudev <itay+github.com@grudev.com> | 2021-09-20 16:48:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-20 16:48:18 +0300 |
commit | 5fec2df7a3cdc192200e6046f7c6d7d3547ce1f5 (patch) | |
tree | 70661fde3971b3649f3b286b986685674c02c03d | |
parent | Merge pull request #134 from itay-grudev/v3.3.0-changelog (diff) | |
parent | Update singleapplication_p.cpp (diff) | |
download | singleapplication-5fec2df7a3cdc192200e6046f7c6d7d3547ce1f5.tar.xz |
Merge pull request #139 from mklein-de/appimage-executable-pathv3.3.1
Added support for _AppImage_ dynamic executable paths. - _Michael Klein_
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | singleapplication_p.cpp | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7359727..4368d0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ Changelog If by accident I have forgotten to credit someone in the CHANGELOG, email me and I will fix it. +__3.3.1__ +--------- + +* Added support for _AppImage_ dynamic executable paths. - _Michael Klein_ + __3.3.0__ --------- diff --git a/singleapplication_p.cpp b/singleapplication_p.cpp index 1339728..1a061f2 100644 --- a/singleapplication_p.cpp +++ b/singleapplication_p.cpp @@ -144,8 +144,17 @@ void SingleApplicationPrivate::genBlockServerName() } if( ! (options & SingleApplication::Mode::ExcludeAppPath) ){ -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) appData.addData( SingleApplication::app_t::applicationFilePath().toLower().toUtf8() ); +#elif defined(Q_OS_LINUX) + // If the application is running as an AppImage then the APPIMAGE env var should be used + // instead of applicationPath() as each instance is launched with its own executable path + const QByteArray appImagePath = qgetenv( "APPIMAGE" ); + if( appImagePath.isEmpty() ){ // Not running as AppImage: use path to executable file + appData.addData( SingleApplication::app_t::applicationFilePath().toUtf8() ); + } else { // Running as AppImage: Use absolute path to AppImage file + appData.addData( appImagePath ); + }; #else appData.addData( SingleApplication::app_t::applicationFilePath().toUtf8() ); #endif |