diff options
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 |