Changeset - r28089:886a1183acc5
[Not reviewed]
master
0 1 0
Patric Stout - 13 months ago 2023-11-04 10:39:18
truebrain@openttd.org
Fix cda6f24f: don't ignore binary-dir if it happens to be working-dir (#11431)

Some of our code ignores the SP_WORKING_DIR for some actions, which
means that if, for example, your SP_BINARY_DIR is the same as your
SP_WORKING_DIR, neither is scanned.

Instead, only add SP_WORKING_DIR if it is unique.
1 file changed with 9 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/fileio.cpp
Show inline comments
 
@@ -87,6 +87,8 @@ static void FillValidSearchPaths(bool on
 

	
 
	std::set<std::string> seen{};
 
	for (Searchpath sp = SP_FIRST_DIR; sp < NUM_SEARCHPATHS; sp++) {
 
		if (sp == SP_WORKING_DIR) continue;
 

	
 
		if (only_local_path) {
 
			switch (sp) {
 
				case SP_WORKING_DIR:      // Can be influence by "-c" option.
 
@@ -105,6 +107,13 @@ static void FillValidSearchPaths(bool on
 
			_valid_searchpaths.emplace_back(sp);
 
		}
 
	}
 

	
 
	/* The working-directory is special, as it is controlled by _do_scan_working_directory.
 
	 * Only add the search path if it isn't already in the set. To preserve the same order
 
	 * as the enum, insert it in the front. */
 
	if (IsValidSearchPath(SP_WORKING_DIR) && seen.count(_searchpaths[SP_WORKING_DIR]) == 0) {
 
		_valid_searchpaths.insert(_valid_searchpaths.begin(), SP_WORKING_DIR);
 
	}
 
}
 

	
 
/**
0 comments (0 inline, 0 general)