mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 15:47:11 +02:00
Add a method to get flatpak ID
This commit is contained in:
parent
256e976167
commit
a6fe5c08ad
1 changed files with 14 additions and 11 deletions
|
@ -132,6 +132,18 @@ uint FileChooserPortalVersion() {
|
|||
}
|
||||
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
QString FlatpakID() {
|
||||
static const auto Result = [] {
|
||||
if (!qEnvironmentVariableIsEmpty("FLATPAK_ID")) {
|
||||
return QString::fromLatin1(qgetenv("FLATPAK_ID"));
|
||||
} else {
|
||||
return GetLauncherBasename();
|
||||
}
|
||||
}();
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
QString ProcessNameByPID(const QString &pid) {
|
||||
constexpr auto kMaxPath = 1024;
|
||||
char result[kMaxPath] = { 0 };
|
||||
|
@ -694,16 +706,7 @@ QString AppRuntimeDirectory() {
|
|||
QStandardPaths::RuntimeLocation);
|
||||
|
||||
if (InFlatpak()) {
|
||||
const auto flatpakId = [&] {
|
||||
if (!qEnvironmentVariableIsEmpty("FLATPAK_ID")) {
|
||||
return QString::fromLatin1(qgetenv("FLATPAK_ID"));
|
||||
} else {
|
||||
return GetLauncherBasename();
|
||||
}
|
||||
}();
|
||||
|
||||
runtimeDir += qsl("/app/")
|
||||
+ flatpakId;
|
||||
runtimeDir += qsl("/app/") + FlatpakID();
|
||||
}
|
||||
|
||||
if (!QFileInfo::exists(runtimeDir)) { // non-systemd distros
|
||||
|
@ -786,7 +789,7 @@ QString GetLauncherFilename() {
|
|||
|
||||
QString GetIconName() {
|
||||
static const auto Result = InFlatpak()
|
||||
? GetLauncherBasename()
|
||||
? FlatpakID()
|
||||
: kIconName.utf16();
|
||||
return Result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue