mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-02 07:25:46 +00:00
Add a method to get flatpak ID
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user