From 7280aa5a48c06c8cf45d03e45d9704268a000213 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 8 Oct 2023 18:15:41 -0400 Subject: [PATCH] Use a better default wine prefix path This manages prefixes by default, like we do with game installs and user documents now. It's still possible to point to an existing wine prefix. --- launcher/include/profilemanager.h | 1 + launcher/profileconfig.kcfg | 1 + launcher/src/launchercore.cpp | 4 ++++ launcher/src/profilemanager.cpp | 7 +++++++ 4 files changed, 13 insertions(+) diff --git a/launcher/include/profilemanager.h b/launcher/include/profilemanager.h index 787a167..2ec9bb1 100644 --- a/launcher/include/profilemanager.h +++ b/launcher/include/profilemanager.h @@ -41,6 +41,7 @@ public: Q_INVOKABLE bool canDelete(Profile *account) const; static QString getDefaultGamePath(const QString &uuid); + static QString getDefaultWinePrefixPath(const QString &uuid); private: void insertProfile(Profile *profile); diff --git a/launcher/profileconfig.kcfg b/launcher/profileconfig.kcfg index a16b9e9..d76ab32 100644 --- a/launcher/profileconfig.kcfg +++ b/launcher/profileconfig.kcfg @@ -22,6 +22,7 @@ SPDX-License-Identifier: CC0-1.0 + ProfileManager::getDefaultWinePrefixPath(mParamuuid) diff --git a/launcher/src/launchercore.cpp b/launcher/src/launchercore.cpp index 31b50c6..048529e 100755 --- a/launcher/src/launchercore.cpp +++ b/launcher/src/launchercore.cpp @@ -218,6 +218,10 @@ QString LauncherCore::getGameArgs(const Profile &profile, const LoginAuth &auth) QDir().mkpath(profile.account()->getConfigDir().absolutePath()); } + if (!QDir().exists(profile.winePrefixPath())) { + QDir().mkpath(profile.winePrefixPath()); + } + if (!auth.lobbyhost.isEmpty()) { gameArgs.push_back({QStringLiteral("DEV.GMServerHost"), auth.frontierHost}); for (int i = 1; i < 9; i++) { diff --git a/launcher/src/profilemanager.cpp b/launcher/src/profilemanager.cpp index ea43bc4..91b5f0f 100644 --- a/launcher/src/profilemanager.cpp +++ b/launcher/src/profilemanager.cpp @@ -97,6 +97,13 @@ QString ProfileManager::getDefaultGamePath(const QString &uuid) #endif } +QString ProfileManager::getDefaultWinePrefixPath(const QString &uuid) +{ + const QDir appData = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::AppDataLocation)[0]; + const QDir prefixDir = appData.absoluteFilePath(QStringLiteral("prefix")); + return prefixDir.absoluteFilePath(uuid); +} + void ProfileManager::load() { auto config = KSharedConfig::openStateConfig();