mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-30 07:21:12 +00:00
Remove duplicated config scanning (see: https://forum.openmw.org/viewtopic.php?f=7&t=2922&p=32940#p32940)
* Requires boost::filesystem::canonical() from v1.48 * reduces startup time * Fixes asset files being listed multiple times in tables
This commit is contained in:
parent
7247da5a77
commit
5bef43ac14
@ -159,15 +159,23 @@ std::pair<Files::PathContainer, std::vector<std::string> > CS::Editor::readConfi
|
|||||||
}
|
}
|
||||||
|
|
||||||
dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
|
dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
|
||||||
|
Files::PathContainer canonicalPaths;
|
||||||
|
|
||||||
//iterate the data directories and add them to the file dialog for loading
|
//iterate the data directories and add them to the file dialog for loading
|
||||||
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
|
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
|
||||||
{
|
{
|
||||||
|
boost::filesystem::path p = boost::filesystem::canonical(*iter);
|
||||||
|
Files::PathContainer::iterator it = std::find(canonicalPaths.begin(), canonicalPaths.end(), p);
|
||||||
|
if (it == canonicalPaths.end())
|
||||||
|
canonicalPaths.push_back(p);
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
QString path = QString::fromUtf8 (iter->string().c_str());
|
QString path = QString::fromUtf8 (iter->string().c_str());
|
||||||
mFileDialog.addFiles(path);
|
mFileDialog.addFiles(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::make_pair (dataDirs, variables["fallback-archive"].as<std::vector<std::string> >());
|
return std::make_pair (canonicalPaths, variables["fallback-archive"].as<std::vector<std::string> >());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CS::Editor::createGame()
|
void CS::Editor::createGame()
|
||||||
|
@ -57,14 +57,24 @@ void ConfigurationManager::readConfiguration(boost::program_options::variables_m
|
|||||||
bool silent = mSilent;
|
bool silent = mSilent;
|
||||||
mSilent = quiet;
|
mSilent = quiet;
|
||||||
|
|
||||||
|
boost::filesystem::path pUser = boost::filesystem::canonical(mFixedPath.getUserConfigPath());
|
||||||
|
boost::filesystem::path pLocal = boost::filesystem::canonical(mFixedPath.getLocalPath());
|
||||||
|
boost::filesystem::path pGlobal = boost::filesystem::canonical(mFixedPath.getGlobalConfigPath());
|
||||||
|
|
||||||
loadConfig(mFixedPath.getUserConfigPath(), variables, description);
|
loadConfig(mFixedPath.getUserConfigPath(), variables, description);
|
||||||
boost::program_options::notify(variables);
|
boost::program_options::notify(variables);
|
||||||
|
|
||||||
loadConfig(mFixedPath.getLocalPath(), variables, description);
|
if (pLocal != pUser)
|
||||||
boost::program_options::notify(variables);
|
{
|
||||||
loadConfig(mFixedPath.getGlobalConfigPath(), variables, description);
|
loadConfig(mFixedPath.getLocalPath(), variables, description);
|
||||||
boost::program_options::notify(variables);
|
boost::program_options::notify(variables);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pGlobal != pUser && pGlobal != pLocal)
|
||||||
|
{
|
||||||
|
loadConfig(mFixedPath.getGlobalConfigPath(), variables, description);
|
||||||
|
boost::program_options::notify(variables);
|
||||||
|
}
|
||||||
mSilent = silent;
|
mSilent = silent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user