diff --git a/src/cli/filter_arg.zig b/src/cli/filter_arg.zig index dbd4e1c52a..8e7a0285a0 100644 --- a/src/cli/filter_arg.zig +++ b/src/cli/filter_arg.zig @@ -143,12 +143,7 @@ pub const FilterSet = struct { }; pub fn init(allocator: std.mem.Allocator, filters: []const []const u8, cwd_: []const u8) !FilterSet { - const cwd: []const u8 = if (comptime bun.Environment.isWindows) brk: { - const c = try allocator.dupe(u8, cwd_); - std.mem.replaceScalar(u8, c, '\\', '/'); - break :brk c; - } else cwd_; - defer if (comptime bun.Environment.isWindows) allocator.free(cwd); + const cwd = cwd_; var buf: bun.PathBuffer = undefined; // TODO fixed buffer allocator with fallback? @@ -164,7 +159,9 @@ pub const FilterSet = struct { const is_path = filter_utf8.len > 0 and filter_utf8[0] == '.'; if (is_path) { const parts = [_]string{filter_utf8}; - filter_utf8 = try allocator.dupe(u8, bun.path.joinAbsStringBuf(cwd, &buf, &parts, .loose)); + const filter_utf8_temp = try allocator.dupe(u8, bun.path.joinAbsStringBuf(cwd, &buf, &parts, .loose)); + std.mem.replaceScalar(u8, filter_utf8_temp, '\\', '/'); + filter_utf8 = filter_utf8_temp; try list.append(.{ .pattern = filter_utf8, .kind = .path, diff --git a/src/glob/ascii.zig b/src/glob/ascii.zig index 848285f7e5..36eedc1eef 100644 --- a/src/glob/ascii.zig +++ b/src/glob/ascii.zig @@ -159,7 +159,7 @@ inline fn globMatchImpl(state: *State, glob: []const u8, path: []const u8) bool const is_end_invalid = state.glob_index < glob.len; // FIXME: explain this bug fix - if (is_end_invalid and state.path_index == path.len and glob.len - state.glob_index == 2 and glob[state.glob_index] == '/' and glob[state.glob_index + 1] == '*') { + if (is_end_invalid and state.path_index == path.len and glob.len - state.glob_index == 2 and isSeparator(glob[state.glob_index]) and glob[state.glob_index + 1] == '*') { continue; }