mirror of
https://github.com/itay-grudev/SingleApplication.git
synced 2025-01-15 00:42:05 +08:00
Use AppImage path for hash when running as AppImage.
When an application is launched as AppImage, each instance is launched from its own FUSE-mounted filesystem, so each instance has its own executable path. The AppImage runtime sets the environment variable APPIMAGE to the absolute path to the .AppImage file, so we can use the content of this variable instead of QApplication::applicationFilePath() when set. Closes #77, #137
This commit is contained in:
parent
d5b3852bd0
commit
f030b378f0
@ -147,7 +147,14 @@ void SingleApplicationPrivate::genBlockServerName()
|
||||
#ifdef Q_OS_WIN
|
||||
appData.addData( SingleApplication::app_t::applicationFilePath().toLower().toUtf8() );
|
||||
#else
|
||||
appData.addData( SingleApplication::app_t::applicationFilePath().toUtf8() );
|
||||
QString appImagePath = qEnvironmentVariable( "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.toUtf8() );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user