diff options
| author | Zousar Shaker <[email protected]> | 2026-04-27 04:49:19 -0600 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-04-27 12:49:19 +0200 |
| commit | 705c8b8d80965584c88f63d4449cbfdfa36138ea (patch) | |
| tree | 819000130104f1d01a0e3605e5f84c4316f52b41 /src/zen | |
| parent | hydration with pack (#1016) (diff) | |
| download | archived-zen-705c8b8d80965584c88f63d4449cbfdfa36138ea.tar.xz archived-zen-705c8b8d80965584c88f63d4449cbfdfa36138ea.zip | |
Zs/user path case comparison (#1015)
- Improvement: `zen builds` `--exclude-folders` and `--exclude-extensions` values now match paths case-insensitively and tolerate surrounding whitespace between separators
Diffstat (limited to 'src/zen')
| -rw-r--r-- | src/zen/cmds/builds_cmd.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/zen/cmds/builds_cmd.cpp b/src/zen/cmds/builds_cmd.cpp index 84d8424aa..775c3d283 100644 --- a/src/zen/cmds/builds_cmd.cpp +++ b/src/zen/cmds/builds_cmd.cpp @@ -1025,19 +1025,22 @@ void BuildsSubCmdBase::ParseExcludeFolderAndExtension(std::vector<std::string>& OutExcludeFolders, std::vector<std::string>& OutExcludeExtensions) { - auto SplitAndAppendExclusion = [](const std::string_view Input, std::vector<std::string>& Output) { - ForEachStrTok(Input, ";,", [&Output](std::string_view Exclusion) { - if (!Exclusion.empty()) - { - std::string CleanExclusion(ToLower(Exclusion)); - if (CleanExclusion.length() > 2 && CleanExclusion.front() == '"' && CleanExclusion.back() == '"') - { - CleanExclusion = CleanExclusion.substr(1, CleanExclusion.length() - 2); - } - Output.emplace_back(std::move(CleanExclusion)); - } - return true; - }); + constexpr AsciiSet Whitespace(" "); + auto SplitAndAppendExclusion = [&Whitespace](const std::string_view Input, std::vector<std::string>& Output) { + ForEachStrTok(Input, ";,", [&Output, &Whitespace](std::string_view Exclusion) { + Exclusion = AsciiSet::TrimPrefixWith(Exclusion, Whitespace); + Exclusion = AsciiSet::TrimSuffixWith(Exclusion, Whitespace); + if (!Exclusion.empty()) + { + std::string CleanExclusion(ToLower(Exclusion)); + if (CleanExclusion.length() > 2 && CleanExclusion.front() == '"' && CleanExclusion.back() == '"') + { + CleanExclusion = CleanExclusion.substr(1, CleanExclusion.length() - 2); + } + Output.emplace_back(std::move(CleanExclusion)); + } + return true; + }); }; SplitAndAppendExclusion(m_Config.ExcludeFolders, OutExcludeFolders); @@ -2546,7 +2549,7 @@ BuildsTestSubCmd::Run(const ZenCliOptions& /*GlobalOptions*/) std::string RelativePath = std::filesystem::relative(AbsolutePath, Path).generic_string(); for (const std::string& ExcludeFolder : ExcludeFolders) { - if (RelativePath.starts_with(ExcludeFolder)) + if (StrCaseStartsWith(RelativePath, ExcludeFolder)) { if (RelativePath.length() == ExcludeFolder.length()) { |