File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -624,13 +624,18 @@ func minifyWorker(chanTasks <-chan Task, chanFails chan<- int) {
624624// compilePattern returns *regexp.Regexp or glob.Glob
625625func compilePattern (pattern string ) (* regexp.Regexp , error ) {
626626 if len (pattern ) == 0 || pattern [0 ] != '~' {
627+ sep := string (filepath .Separator )
628+ if sep == `\` {
629+ sep = `\\`
630+ }
631+
627632 if strings .HasPrefix (pattern , `\~` ) {
628633 pattern = pattern [1 :]
629634 }
630635 pattern = regexp .QuoteMeta (pattern )
631636 pattern = strings .ReplaceAll (pattern , `\*\*` , `.*` )
632- pattern = strings .ReplaceAll (pattern , `\*` , fmt .Sprintf (`[^%c ]*` , filepath . Separator ))
633- pattern = strings .ReplaceAll (pattern , `\?` , fmt .Sprintf (`[^%c ]?` , filepath . Separator ))
637+ pattern = strings .ReplaceAll (pattern , `\*` , fmt .Sprintf (`[^%s ]*` , sep ))
638+ pattern = strings .ReplaceAll (pattern , `\?` , fmt .Sprintf (`[^%s ]?` , sep ))
634639 pattern = "^" + pattern + "$"
635640 }
636641 return regexp .Compile (pattern )
You can’t perform that action at this time.
0 commit comments