From 6dcdddbf733b0aa323ffb7ecbe56c04b15c6c16a Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Mon, 24 Nov 2025 10:06:52 +0100 Subject: update state when wildcard (#657) * add --append option and improve state handling when using downloads for `zen builds download` --- src/zenutil/wildcard.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/zenutil/wildcard.cpp') 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 IncludeWildcards, + std::span 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 -- cgit v1.2.3