carb::filesystem::findFiles
Defined in carb/filesystem/FindFiles.h
-
inline bool carb::filesystem::findFiles(const FindFilesArgs &args)
Finds files in a given list of search paths matching a given list of patterns.
See FindFilesArgs for argument documentation.
The search can be incredibly expensive:
O(searchPathsCount^(<files>^(ignorePrefixesCount^(matchWildcardsCount + excludeWildcardsCount))))
The following Python-ish pseudo-code gives you an idea of the algorithm used:
foreach path in searchPaths: path = substituteEnvVars(path) foreach file in path: if eContinue == onFilterNonCanonical(file): foreach prefix in ["", ignorePrefixes]: stripped = prefix[len(prefix):] matched = False if isMatch(stripped, matchWildcards): # loops over each wildcard pattern if isMatch(stripped, excludeWildcards): # loops over each wildcard pattern return # any match of an exclusion pattern immediately excludes the file else: matched = True if matched: return onMatched(canonical)
- Parameters
args – The arguments as a structure
- Returns
true
if the filesystem was searched;false
otherwise.