|
@@ -13,7 +13,6 @@ import (
|
|
"math/rand"
|
|
"math/rand"
|
|
"path/filepath"
|
|
"path/filepath"
|
|
"sort"
|
|
"sort"
|
|
- "strings"
|
|
|
|
"sync/atomic"
|
|
"sync/atomic"
|
|
"time"
|
|
"time"
|
|
|
|
|
|
@@ -411,7 +410,6 @@ func (f *folder) scanSubdirs(subDirs []string) error {
|
|
// ignored files.
|
|
// ignored files.
|
|
var toIgnore []db.FileInfoTruncated
|
|
var toIgnore []db.FileInfoTruncated
|
|
ignoredParent := ""
|
|
ignoredParent := ""
|
|
- pathSep := string(fs.PathSeparator)
|
|
|
|
for _, sub := range subDirs {
|
|
for _, sub := range subDirs {
|
|
var iterError error
|
|
var iterError error
|
|
|
|
|
|
@@ -423,7 +421,7 @@ func (f *folder) scanSubdirs(subDirs []string) error {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
- if ignoredParent != "" && !strings.HasPrefix(file.Name, ignoredParent+pathSep) {
|
|
|
|
|
|
+ if ignoredParent != "" && !fs.IsParent(file.Name, ignoredParent) {
|
|
for _, file := range toIgnore {
|
|
for _, file := range toIgnore {
|
|
l.Debugln("marking file as ignored", file)
|
|
l.Debugln("marking file as ignored", file)
|
|
nf := file.ConvertToIgnoredFileInfo(f.model.id.Short())
|
|
nf := file.ConvertToIgnoredFileInfo(f.model.id.Short())
|
|
@@ -698,11 +696,10 @@ func (f *folder) clearScanErrors(subDirs []string) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
filtered := f.scanErrors[:0]
|
|
filtered := f.scanErrors[:0]
|
|
- pathSep := string(fs.PathSeparator)
|
|
|
|
outer:
|
|
outer:
|
|
for _, fe := range f.scanErrors {
|
|
for _, fe := range f.scanErrors {
|
|
for _, sub := range subDirs {
|
|
for _, sub := range subDirs {
|
|
- if strings.HasPrefix(fe.Path, sub+pathSep) {
|
|
|
|
|
|
+ if fe.Path == sub || fs.IsParent(fe.Path, sub) {
|
|
continue outer
|
|
continue outer
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -735,7 +732,7 @@ func unifySubs(dirs []string, exists func(dir string) bool) []string {
|
|
dirs = append(dirs[:i], dirs[i+1:]...)
|
|
dirs = append(dirs[:i], dirs[i+1:]...)
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
- if dir == prev || strings.HasPrefix(dir, prev+string(fs.PathSeparator)) {
|
|
|
|
|
|
+ if dir == prev || fs.IsParent(dir, prev) {
|
|
dirs = append(dirs[:i], dirs[i+1:]...)
|
|
dirs = append(dirs[:i], dirs[i+1:]...)
|
|
continue
|
|
continue
|
|
}
|
|
}
|