Remove the ability to have multiple search paths for config.

This commit is contained in:
Henrik Rydgård committed 2021-05-30 12:45:12 +02:00
1 parent 72915f88c8
commit 239838b6c3
5 files changed
+16 -32

No files matched your search

+10 -19
View File
@@ -1577,12 +1577,8 @@ void Config::CleanRecent() {
recentIsos = cleanedRecent;
}
void Config::SetDefaultPath(const Path &defaultPath) {
defaultPath_ = defaultPath;
}
void Config::AddSearchPath(const Path &path) {
searchPath_.push_back(path);
void Config::SetSearchPath(const Path &searchPath) {
searchPath_ = searchPath;
}
const Path Config::FindConfigFile(const std::string &baseFilename) {
@@ -1596,21 +1592,16 @@ const Path Config::FindConfigFile(const std::string &baseFilename) {
}
#endif
for (size_t i = 0; i < searchPath_.size(); ++i) {
Path filename = searchPath_[i] / baseFilename;
if (File::Exists(filename)) {
return filename;
}
Path filename = searchPath_ / baseFilename;
if (File::Exists(filename)) {
return filename;
}
const Path filename = defaultPath_ / baseFilename;
if (!File::Exists(filename)) {
// Make sure at least the directory it's supposed to be in exists.
Path path = filename.NavigateUp();
// This check is just to avoid logging.
if (!File::Exists(path)) {
File::CreateFullPath(path);
}
// Make sure at least the directory it's supposed to be in exists.
Path path = filename.NavigateUp();
// This check is just to avoid logging.
if (!File::Exists(path)) {
File::CreateFullPath(path);
}
return filename;
}