Load all config files

pull/3235/head
AnyOldName3 10 months ago
parent 595e42ae43
commit 357bf3db61

@ -349,17 +349,11 @@ bool Launcher::MainDialog::setupGameSettings()
if (!loadFile(Files::getUserConfigPathQString(mCfgMgr), &Config::GameSettings::readUserFile))
return false;
// Now the rest - priority: user > local > global
if (auto result = loadFile(Files::getLocalConfigPathQString(mCfgMgr), &Config::GameSettings::readFile, true))
for (const auto& path : Files::getActiveConfigPathsQString(mCfgMgr))
{
// Load global if local wasn't found
if (!*result && !loadFile(Files::getGlobalConfigPathQString(mCfgMgr), &Config::GameSettings::readFile, true))
if (!loadFile(path, &Config::GameSettings::readFile))
return false;
}
else
return false;
if (!loadFile(Files::getUserConfigPathQString(mCfgMgr), &Config::GameSettings::readFile))
return false;
return true;
}

@ -22,6 +22,16 @@ namespace Files
{
return Files::pathToQString(cfgMgr.getGlobalPath() / openmwCfgFile);
}
inline QStringList getActiveConfigPathsQString(const Files::ConfigurationManager& cfgMgr)
{
const auto& activePaths = cfgMgr.getActiveConfigPaths();
QStringList result;
result.reserve(static_cast<int>(activePaths.size()));
for (const auto& path : activePaths)
result.append(Files::pathToQString(path / openmwCfgFile));
return result;
}
}
#endif // OPENMW_COMPONENTS_FILES_QTCONFIGPATH_H

Loading…
Cancel
Save