From 3a4bf525adedf8e8afc5d1c97e108b705550d9b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Fri, 22 Aug 2025 14:12:02 +0200 Subject: [PATCH] Fix global config path on Linux --- src/qt/qt_platform.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 472277cbb..0de5d840c 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -361,7 +361,9 @@ path_append_filename(char *dest, const char *s1, const char *s2) if (!dest || !s1 || !s2) return; - snprintf(dest, dest_size, "%s", s1); + if (dest != s1) + snprintf(dest, dest_size, "%s", s1); + len = strlen(dest); if (len > 0 && dest[len - 1] != '/' && dest[len - 1] != '\\') { @@ -678,7 +680,7 @@ plat_get_global_config_dir(char *outbuf, const size_t len) void plat_get_global_data_dir(char *outbuf, const size_t len) { - const auto dir = QDir(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)[0]); + const auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); if (!dir.exists()) { if (!dir.mkpath(".")) { qWarning("Failed to create global data directory %s", dir.absolutePath().toUtf8().constData()); @@ -690,7 +692,7 @@ plat_get_global_data_dir(char *outbuf, const size_t len) void plat_get_temp_dir(char *outbuf, const uint8_t len) { - const auto dir = QDir(QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0]); + const auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); strncpy(outbuf, dir.canonicalPath().toUtf8().constData(), len); } @@ -700,7 +702,7 @@ plat_get_vmm_dir(char *outbuf, const size_t len) #ifdef Q_OS_WINDOWS const auto path = QDir::home().filePath("86Box VMs"); #else - const auto path = QDir(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)[0]).filePath("Virtual Machines"); + const auto path = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("Virtual Machines"); #endif strncpy(outbuf, path.toUtf8().constData(), len); }