diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 0bcaff6a52..c70b3dd19e 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -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() diff --git a/components/files/configurationmanager.cpp b/components/files/configurationmanager.cpp index dc6f02b608..ac461697aa 100644 --- a/components/files/configurationmanager.cpp +++ b/components/files/configurationmanager.cpp @@ -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; }