MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DoScanWorkingDirectory

Function DoScanWorkingDirectory

src/fileio.cpp:711–726  ·  view source on GitHub ↗

* Whether we should scan the working directory. * It should not be scanned if it's the root or * the home directory as in both cases a big data * directory can cause huge amounts of unrelated * files scanned. Furthermore there are nearly no * use cases for the home/root directory to have * OpenTTD directories. * @return true if it should be scanned. */

Source from the content-addressed store, hash-verified

709 * @return true if it should be scanned.
710 */
711bool DoScanWorkingDirectory()
712{
713 /* No working directory, so nothing to do. */
714 if (_searchpaths[SP_WORKING_DIR].empty()) return false;
715
716 /* Working directory is root, so do nothing. */
717 if (_searchpaths[SP_WORKING_DIR] == PATHSEP) return false;
718
719 /* No personal/home directory, so the working directory won't be that. */
720 if (_searchpaths[SP_PERSONAL_DIR].empty()) return true;
721
722 std::string tmp = _searchpaths[SP_WORKING_DIR] + PERSONAL_DIR;
723 AppendPathSeparator(tmp);
724
725 return _searchpaths[SP_PERSONAL_DIR] != tmp;
726}
727
728/**
729 * Gets the home directory of the user.

Callers 1

DetermineBasePathsFunction · 0.85

Calls 2

AppendPathSeparatorFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected