Skip to content

Commit

Permalink
Change: Filter duplicate paths from valid search path list. (#11363)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterN committed Oct 9, 2023
1 parent 0458c15 commit cda6f24
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/fileio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
}
}

Expand Down

0 comments on commit cda6f24

Please sign in to comment.