Skip to content

Commit

Permalink
Fix glob problem on Windows.
Browse files Browse the repository at this point in the history
We weren't actually escaping every use of the file path separator. D'oh.
  • Loading branch information
BurntSushi committed Sep 6, 2016
1 parent 7f0273c commit 3bb387a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl Pattern {
/// regular expression and will represent the matching semantics of this
/// glob pattern and the options given.
pub fn to_regex_with(&self, options: &MatchOptions) -> String {
let sep = path::MAIN_SEPARATOR.to_string();
let sep = regex::quote(&path::MAIN_SEPARATOR.to_string());
let mut re = String::new();
re.push_str("(?-u)");
if options.case_insensitive {
Expand All @@ -235,14 +235,14 @@ impl Pattern {
}
Token::Any => {
if options.require_literal_separator {
re.push_str(&format!("[^{}]", regex::quote(&sep)));
re.push_str(&format!("[^{}]", sep));
} else {
re.push_str(".");
}
}
Token::ZeroOrMore => {
if options.require_literal_separator {
re.push_str(&format!("[^{}]*", regex::quote(&sep)));
re.push_str(&format!("[^{}]*", sep));
} else {
re.push_str(".*");
}
Expand Down

0 comments on commit 3bb387a

Please sign in to comment.