Skip to content

Commit

Permalink
Add 'allowWindowsEscape' option
Browse files Browse the repository at this point in the history
  • Loading branch information
frandiox committed Oct 20, 2016
1 parent eed8949 commit 79006e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ Suppress the behavior of treating a leading `!` character as negation.
Returns from negate expressions the same as if they were not negated.
(Ie, true on a hit, false on a miss.)

### allowWindowsEscape

Windows path separator `\` is by default converted to `/`, which
prohibits the usage of `\` as a escape character. This flag skips that
behavior and allows using the escape character.

## Comparisons to other fnmatch/glob implementations

Expand Down
4 changes: 2 additions & 2 deletions minimatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function Minimatch (pattern, options) {
pattern = pattern.trim()

// windows support: need to use /, not \
if (path.sep !== '/') {
if (!options.allowWindowsEscape && path.sep !== '/') {
pattern = pattern.split(path.sep).join('/')
}

Expand Down Expand Up @@ -709,7 +709,7 @@ function match (f, partial) {
var options = this.options

// windows: need to use /, not \
if (path.sep !== '/') {
if (!options.allowWindowsEscape && path.sep !== '/') {
f = f.split(path.sep).join('/')
}

Expand Down

0 comments on commit 79006e4

Please sign in to comment.