mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-15 16:39:40 +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
2 changed files with 23 additions and 5 deletions
|
@ -159,15 +159,23 @@ std::pair<Files::PathContainer, std::vector<std::string> > CS::Editor::readConfi
|
|||
}
|
||||
|
||||
dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
|
||||
Files::PathContainer canonicalPaths;
|
||||
|
||||
//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)
|
||||
{
|
||||
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());
|
||||
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()
|
||||
|
|
|
@ -57,14 +57,24 @@ void ConfigurationManager::readConfiguration(boost::program_options::variables_m
|
|||
bool silent = mSilent;
|
||||
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);
|
||||
boost::program_options::notify(variables);
|
||||
|
||||
loadConfig(mFixedPath.getLocalPath(), variables, description);
|
||||
boost::program_options::notify(variables);
|
||||
loadConfig(mFixedPath.getGlobalConfigPath(), variables, description);
|
||||
boost::program_options::notify(variables);
|
||||
if (pLocal != pUser)
|
||||
{
|
||||
loadConfig(mFixedPath.getLocalPath(), variables, description);
|
||||
boost::program_options::notify(variables);
|
||||
}
|
||||
|
||||
if (pGlobal != pUser && pGlobal != pLocal)
|
||||
{
|
||||
loadConfig(mFixedPath.getGlobalConfigPath(), variables, description);
|
||||
boost::program_options::notify(variables);
|
||||
}
|
||||
mSilent = silent;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue