diff options
| author | Dan Engelbrecht <[email protected]> | 2025-11-24 10:06:52 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-11-24 10:06:52 +0100 |
| commit | 6dcdddbf733b0aa323ffb7ecbe56c04b15c6c16a (patch) | |
| tree | 78685156e98214e4e1125501a8c09cac37bc45f4 /src/zenutil/wildcard.cpp | |
| parent | changelog (#661) (diff) | |
| download | zen-6dcdddbf733b0aa323ffb7ecbe56c04b15c6c16a.tar.xz zen-6dcdddbf733b0aa323ffb7ecbe56c04b15c6c16a.zip | |
update state when wildcard (#657)
* add --append option and improve state handling when using downloads for `zen builds download`
Diffstat (limited to 'src/zenutil/wildcard.cpp')
| -rw-r--r-- | src/zenutil/wildcard.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/zenutil/wildcard.cpp b/src/zenutil/wildcard.cpp index d9d5b384f..7a44c0498 100644 --- a/src/zenutil/wildcard.cpp +++ b/src/zenutil/wildcard.cpp @@ -78,6 +78,39 @@ MatchWildcard(std::string_view Wildcard, std::string_view String, bool CaseSensi } } +bool +IncludePath(std::span<const std::string> IncludeWildcards, + std::span<const std::string> ExcludeWildcards, + const std::string& Path, + bool CaseSensitive) +{ + bool IncludePath = true; + if (!IncludeWildcards.empty()) + { + IncludePath = false; + for (const std::string& IncludeWildcard : IncludeWildcards) + { + if (MatchWildcard(IncludeWildcard, Path, CaseSensitive)) + { + IncludePath = true; + break; + } + } + if (!IncludePath) + { + return false; + } + } + for (const std::string& ExcludeWildcard : ExcludeWildcards) + { + if (MatchWildcard(ExcludeWildcard, Path, CaseSensitive)) + { + return false; + } + } + return true; +} + #if ZEN_WITH_TESTS void |