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)) if (!loadFile(Files::getUserConfigPathQString(mCfgMgr), &Config::GameSettings::readUserFile))
return false; return false;
// Now the rest - priority: user > local > global for (const auto& path : Files::getActiveConfigPathsQString(mCfgMgr))
if (auto result = loadFile(Files::getLocalConfigPathQString(mCfgMgr), &Config::GameSettings::readFile, true))
{ {
// Load global if local wasn't found if (!loadFile(path, &Config::GameSettings::readFile))
if (!*result && !loadFile(Files::getGlobalConfigPathQString(mCfgMgr), &Config::GameSettings::readFile, true))
return false; return false;
} }
else
return false;
if (!loadFile(Files::getUserConfigPathQString(mCfgMgr), &Config::GameSettings::readFile))
return false;
return true; return true;
} }

@ -22,6 +22,16 @@ namespace Files
{ {
return Files::pathToQString(cfgMgr.getGlobalPath() / openmwCfgFile); 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 #endif // OPENMW_COMPONENTS_FILES_QTCONFIGPATH_H

Loading…
Cancel
Save