* 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. */
| 709 | * @return true if it should be scanned. |
| 710 | */ |
| 711 | bool 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. |
no test coverage detected