Skip to content

Commit 3bb387a

Browse files
committed
Fix glob problem on Windows.
We weren't actually escaping every use of the file path separator. D'oh.
1 parent 7f0273c commit 3bb387a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/glob.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl Pattern {
214214
/// regular expression and will represent the matching semantics of this
215215
/// glob pattern and the options given.
216216
pub fn to_regex_with(&self, options: &MatchOptions) -> String {
217-
let sep = path::MAIN_SEPARATOR.to_string();
217+
let sep = regex::quote(&path::MAIN_SEPARATOR.to_string());
218218
let mut re = String::new();
219219
re.push_str("(?-u)");
220220
if options.case_insensitive {
@@ -235,14 +235,14 @@ impl Pattern {
235235
}
236236
Token::Any => {
237237
if options.require_literal_separator {
238-
re.push_str(&format!("[^{}]", regex::quote(&sep)));
238+
re.push_str(&format!("[^{}]", sep));
239239
} else {
240240
re.push_str(".");
241241
}
242242
}
243243
Token::ZeroOrMore => {
244244
if options.require_literal_separator {
245-
re.push_str(&format!("[^{}]*", regex::quote(&sep)));
245+
re.push_str(&format!("[^{}]*", sep));
246246
} else {
247247
re.push_str(".*");
248248
}

0 commit comments

Comments
 (0)