mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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
|
#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) {
|
QString ProcessNameByPID(const QString &pid) {
|
||||||
constexpr auto kMaxPath = 1024;
|
constexpr auto kMaxPath = 1024;
|
||||||
char result[kMaxPath] = { 0 };
|
char result[kMaxPath] = { 0 };
|
||||||
|
@ -694,16 +706,7 @@ QString AppRuntimeDirectory() {
|
||||||
QStandardPaths::RuntimeLocation);
|
QStandardPaths::RuntimeLocation);
|
||||||
|
|
||||||
if (InFlatpak()) {
|
if (InFlatpak()) {
|
||||||
const auto flatpakId = [&] {
|
runtimeDir += qsl("/app/") + FlatpakID();
|
||||||
if (!qEnvironmentVariableIsEmpty("FLATPAK_ID")) {
|
|
||||||
return QString::fromLatin1(qgetenv("FLATPAK_ID"));
|
|
||||||
} else {
|
|
||||||
return GetLauncherBasename();
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
runtimeDir += qsl("/app/")
|
|
||||||
+ flatpakId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QFileInfo::exists(runtimeDir)) { // non-systemd distros
|
if (!QFileInfo::exists(runtimeDir)) { // non-systemd distros
|
||||||
|
@ -786,7 +789,7 @@ QString GetLauncherFilename() {
|
||||||
|
|
||||||
QString GetIconName() {
|
QString GetIconName() {
|
||||||
static const auto Result = InFlatpak()
|
static const auto Result = InFlatpak()
|
||||||
? GetLauncherBasename()
|
? FlatpakID()
|
||||||
: kIconName.utf16();
|
: kIconName.utf16();
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue