filter: cleanup path separator conversion
This commit is contained in:
parent
0acc3c5923
commit
8388e67c4b
1 changed files with 2 additions and 10 deletions
|
@ -24,21 +24,13 @@ func prepareStr(str string) ([]string, error) {
|
||||||
return nil, ErrBadString
|
return nil, ErrBadString
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert file path separator to '/'
|
str = filepath.ToSlash(str)
|
||||||
if filepath.Separator != '/' {
|
|
||||||
str = strings.Replace(str, string(filepath.Separator), "/", -1)
|
|
||||||
}
|
|
||||||
|
|
||||||
return strings.Split(str, "/"), nil
|
return strings.Split(str, "/"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func preparePattern(pattern string) Pattern {
|
func preparePattern(pattern string) Pattern {
|
||||||
pattern = filepath.Clean(pattern)
|
pattern = filepath.Clean(pattern)
|
||||||
|
pattern = filepath.ToSlash(pattern)
|
||||||
// convert file path separator to '/'
|
|
||||||
if filepath.Separator != '/' {
|
|
||||||
pattern = strings.Replace(pattern, string(filepath.Separator), "/", -1)
|
|
||||||
}
|
|
||||||
|
|
||||||
parts := strings.Split(pattern, "/")
|
parts := strings.Split(pattern, "/")
|
||||||
patterns := make([]patternPart, len(parts))
|
patterns := make([]patternPart, len(parts))
|
||||||
|
|
Loading…
Reference in a new issue