aboutsummaryrefslogtreecommitdiff
path: root/singleapplication_p.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'singleapplication_p.cpp')
-rw-r--r--singleapplication_p.cpp11
1 files changed, 10 insertions, 1 deletions
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