Skip to content

Commit 760bb41

Browse files
authored
Merge pull request #60 from zao/fix/exact-file-search
fix: drop leading garbage from exact glob pattern
2 parents b9118e2 + 96d8e46 commit 760bb41

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

engine/system/win/sys_main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ bool GlobMatch(const std::filesystem::path& glob, const std::filesystem::path& f
150150
// If no wildcards are present, test file path verbatim.
151151
// We use a regex rather than string comparisons to make it case-insensitive.
152152
if (globStr.find_first_of("?*") == std::string::npos) {
153-
buf.resize(globStr.size());
153+
buf.reserve(globStr.size() * 3); // Decent estimate of final pattern size.
154+
154155
for (char ch : globStr) {
155156
fmt::format_to(fmt::appender(buf), "[{}]", ch);
156157
}

0 commit comments

Comments
 (0)