2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Get rid of workarounds for old flatpak versions

The minimal supported flatpak version since Qt 6.x is 1.14.0.
Flatpak shares temp directory and runtime directory between launches since 1.11.1.
FLATPAK_ID is defined since 1.1.2.
This commit is contained in:
Ilya Fedin
2022-11-07 12:39:07 +04:00
committed by John Preston
parent bd8b90055e
commit a507edb67a
3 changed files with 3 additions and 48 deletions

View File

@@ -247,29 +247,6 @@ bool GenerateDesktopFile(
}
}
QString AppRuntimeDirectory() {
static const auto Result = [&] {
auto runtimeDir = QStandardPaths::writableLocation(
QStandardPaths::RuntimeLocation);
if (KSandbox::isFlatpak()) {
runtimeDir += qsl("/app/") + base::FlatpakID();
}
if (!QFileInfo::exists(runtimeDir)) { // non-systemd distros
runtimeDir = QDir::tempPath();
}
if (!runtimeDir.endsWith('/')) {
runtimeDir += '/';
}
return runtimeDir;
}();
return Result;
}
} // namespace
void SetApplicationIcon(const QIcon &icon) {
@@ -277,16 +254,7 @@ void SetApplicationIcon(const QIcon &icon) {
}
QString SingleInstanceLocalServerName(const QString &hash) {
const auto idealSocketPath = AppRuntimeDirectory()
+ hash
+ '-'
+ cGUIDStr();
if ((idealSocketPath.size() + 1) >= sizeof(sockaddr_un().sun_path)) {
return AppRuntimeDirectory() + hash;
} else {
return idealSocketPath;
}
return QDir::tempPath() + '/' + hash + '-' + cGUIDStr();
}
std::optional<bool> IsDarkMode() {