mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 08:15:37 +00:00
Load all config files
This commit is contained in:
parent
595e42ae43
commit
357bf3db61
2 changed files with 12 additions and 8 deletions
|
@ -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…
Reference in a new issue