diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-18 12:42:09 -0600 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-18 12:42:09 -0600 |
| commit | 7e13a388ba568b964663f55c06bbee5818e96655 (patch) | |
| tree | 9bb27af71caec919dfc38783cfbd231d2c66aecc /libs | |
| parent | 276bf2fac226b5ac3059120edc4dfb55578ca601 (diff) | |
Read Fluorine prefix path from config.json instead of QSettings
Replace QSettings().value("fluorine/prefix_path") with a helper that
reads fluorine/config.json directly, matching how the rest of the
app resolves the prefix path.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/game_bethesda/src/gamebryo/gamegamebryo.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/libs/game_bethesda/src/gamebryo/gamegamebryo.cpp b/libs/game_bethesda/src/gamebryo/gamegamebryo.cpp index cc561b6..b53d823 100644 --- a/libs/game_bethesda/src/gamebryo/gamegamebryo.cpp +++ b/libs/game_bethesda/src/gamebryo/gamegamebryo.cpp @@ -22,6 +22,7 @@ #include <QFileInfo> #include <QIcon> #include <QJsonDocument> +#include <QJsonObject> #include <QJsonValue> #include <QSettings> #include <QStandardPaths> @@ -505,6 +506,22 @@ QString GameGamebryo::myGamesPath() const #endif } +static QString readFluorinePrefixPath() +{ + QString configRoot = + QStandardPaths::writableLocation(QStandardPaths::ConfigLocation); + if (configRoot.isEmpty()) + configRoot = QDir::homePath() + "/.config"; + QString configPath = QDir(configRoot).filePath("fluorine/config.json"); + QFile f(configPath); + if (!f.open(QIODevice::ReadOnly)) + return {}; + auto json = QJsonDocument::fromJson(f.readAll()); + if (!json.isObject()) + return {}; + return json.object().value("prefix_path").toString().trimmed(); +} + QString GameGamebryo::localAppFolder() { #ifdef _WIN32 @@ -516,8 +533,7 @@ QString GameGamebryo::localAppFolder() return result; #else // On Linux, AppData/Local lives inside the Wine prefix. - const QString configuredPrefix = - QSettings().value("fluorine/prefix_path").toString().trimmed(); + const QString configuredPrefix = readFluorinePrefixPath(); if (!configuredPrefix.isEmpty()) { const QString appDataLocal = QDir(configuredPrefix).filePath("drive_c/users/steamuser/AppData/Local"); @@ -729,9 +745,8 @@ QString GameGamebryo::determineMyGamesPath(const QString& gameName) // Check common Wine prefix locations for steamuser Documents. QStringList prefixDocPaths; - // First check the configured prefix from MO2 settings (most reliable). - const QString configuredPrefix = - QSettings().value("fluorine/prefix_path").toString().trimmed(); + // First check the configured prefix from fluorine config (most reliable). + const QString configuredPrefix = readFluorinePrefixPath(); if (!configuredPrefix.isEmpty()) { const QString configuredDocs = QDir(configuredPrefix).filePath("drive_c/users/steamuser/Documents"); |
