Changeset - r27990:bea5843ebd38
[Not reviewed]
master
0 1 0
Peter Nelson - 14 months ago 2023-10-09 21:38:13
peter1138@openttd.org
Change: Filter duplicate paths from valid search path list. (#11363)
1 file changed with 7 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/fileio.cpp
Show inline comments
 
@@ -84,6 +84,8 @@ static bool IsValidSearchPath(Searchpath
 
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 on
 
			}
 
		}
 

	
 
		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);
 
		}
 
	}
 
}
 

	
0 comments (0 inline, 0 general)