mirror of
https://github.com/octoleo/restic.git
synced 2024-11-29 08:14:03 +00:00
filter: cleanup path separator conversion
This commit is contained in:
parent
0acc3c5923
commit
8388e67c4b
@ -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 New Issue
Block a user