diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index 9e812138c8..8db0076af5 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -301,7 +301,7 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName) [&](const Config::SettingValue& dir) { return mGameSettings.isUserSetting(dir); }), directories.end()); for (const auto& dir : contentModelDirectories) - directories.push_back({ dir }); + directories.push_back(mGameSettings.procesPathSettingValue({ dir })); } mDataLocal = mGameSettings.getDataLocal(); diff --git a/components/config/gamesettings.cpp b/components/config/gamesettings.cpp index a7da8fa150..7015f86c04 100644 --- a/components/config/gamesettings.cpp +++ b/components/config/gamesettings.cpp @@ -178,9 +178,7 @@ bool Config::GameSettings::readFile( value.originalRepresentation = value.value; } - std::filesystem::path path = Files::pathFromQString(value.value); - mCfgMgr.processPath(path, Files::pathFromQString(context)); - value.value = Files::pathToQString(path); + value = procesPathSettingValue(value); } if (ignoreContent && (key == QLatin1String("content") || key == QLatin1String("data"))) continue; @@ -588,6 +586,14 @@ bool Config::GameSettings::isUserSetting(const SettingValue& settingValue) const return settingValue.context.isEmpty() || settingValue.context == getUserContext(); } +Config::SettingValue Config::GameSettings::procesPathSettingValue(const SettingValue& value) +{ + std::filesystem::path path = Files::pathFromQString(value.value); + std::filesystem::path basePath = Files::pathFromQString(value.context.isEmpty() ? getUserContext() : value.context); + mCfgMgr.processPath(path, basePath); + return SettingValue{ Files::pathToQString(path), value.originalRepresentation, value.context }; +} + void Config::GameSettings::clear() { mSettings.clear(); diff --git a/components/config/gamesettings.hpp b/components/config/gamesettings.hpp index 89139ff41a..d31d3bf897 100644 --- a/components/config/gamesettings.hpp +++ b/components/config/gamesettings.hpp @@ -118,6 +118,8 @@ namespace Config const QString& getUserContext() const { return mContexts.back(); } bool isUserSetting(const SettingValue& settingValue) const; + SettingValue procesPathSettingValue(const SettingValue& value); + void clear(); private: diff --git a/components/config/launchersettings.cpp b/components/config/launchersettings.cpp index f4749d0f93..449edd1b89 100644 --- a/components/config/launchersettings.cpp +++ b/components/config/launchersettings.cpp @@ -1,6 +1,7 @@ #include "launchersettings.hpp" #include +#include #include #include #include @@ -263,8 +264,17 @@ void Config::LauncherSettings::setContentList(const GameSettings& gameSettings) for (const QString& listName : getContentLists()) { const auto& listDirs = getDataDirectoryList(listName); - if (!std::ranges::equal( - dirs, listDirs, [](const SettingValue& dir, const QString& listDir) { return dir.value == listDir; })) +#ifdef Q_OS_WINDOWS + constexpr auto caseSensitivity = Qt::CaseInsensitive; +#else + constexpr auto caseSensitivity = Qt::CaseSensitive; +#endif + constexpr auto compareDataDirectories = [caseSensitivity](const SettingValue& dir, const QString& listDir) { + return dir.originalRepresentation == listDir + || QDir::cleanPath(dir.originalRepresentation) + .compare(QDir::cleanPath(listDir), caseSensitivity) == 0; + }; + if (!std::ranges::equal(dirs, listDirs, compareDataDirectories)) continue; constexpr auto compareFiles = [](const QString& a, const QString& b) { return a.compare(b, Qt::CaseInsensitive) == 0; }; @@ -281,7 +291,7 @@ void Config::LauncherSettings::setContentList(const GameSettings& gameSettings) setCurrentContentListName(newContentListName); QStringList newListDirs; for (const auto& dir : dirs) - newListDirs.push_back(dir.value); + newListDirs.push_back(dir.originalRepresentation); setContentList(newContentListName, newListDirs, archives, files); }