Change: Filter duplicate paths from valid search path list. (#11363)

pull/615/head
Peter Nelson 8 months ago committed by GitHub
parent 0458c15060
commit cda6f24fe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -84,6 +84,8 @@ static bool IsValidSearchPath(Searchpath sp)
static void FillValidSearchPaths(bool only_local_path)
{
_valid_searchpaths.clear();
std::set<std::string> seen{};
for (Searchpath sp = SP_FIRST_DIR; sp < NUM_SEARCHPATHS; sp++) {
if (only_local_path) {
switch (sp) {
@ -97,7 +99,11 @@ static void FillValidSearchPaths(bool only_local_path)
}
}
if (IsValidSearchPath(sp)) _valid_searchpaths.emplace_back(sp);
if (IsValidSearchPath(sp)) {
if (seen.count(_searchpaths[sp]) != 0) continue;
seen.insert(_searchpaths[sp]);
_valid_searchpaths.emplace_back(sp);
}
}
}

Loading…
Cancel
Save