Utils: Add a FilePath::searchAllInDirectories

A variation that does not stop on the first found item.
Useful for auto-detection scenarios.

Use "WithAnySuffix" as default to cover .cmd and .bat etc.

Change-Id: I48f36eff06699c046e34c8e2646546bcff20ae8b
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-05-23 09:14:23 +02:00
parent 27a63b0930
commit ae26fa0dd7
2 changed files with 75 additions and 10 deletions

View File

@@ -187,11 +187,18 @@ public:
[[nodiscard]] FilePath searchInDirectories(const FilePaths &dirs,
const FilePathPredicate &filter = {},
const MatchScope &matchScope = {}) const;
const MatchScope &matchScope = WithAnySuffix) const;
[[nodiscard]] FilePaths searchAllInDirectories(const FilePaths &dirs,
const FilePathPredicate &filter = {},
const MatchScope &matchScope = WithAnySuffix) const;
[[nodiscard]] FilePath searchInPath(const FilePaths &additionalDirs = {},
PathAmending = AppendToPath,
const FilePathPredicate &filter = {},
const MatchScope &matchScope = {}) const;
MatchScope matchScope = WithAnySuffix) const;
[[nodiscard]] FilePaths searchAllInPath(const FilePaths &additionalDirs = {},
PathAmending = AppendToPath,
const FilePathPredicate &filter = {},
MatchScope matchScope = WithAnySuffix) const;
std::optional<FilePath> refersToExecutableFile(MatchScope considerScript) const;