forked from TrueCloudLab/rclone
path -> startPath in walkRDirTree (we need the path package)
This commit is contained in:
parent
a3a436ce16
commit
cef2e3bf83
1 changed files with 5 additions and 5 deletions
10
fs/walk.go
10
fs/walk.go
|
@ -347,10 +347,10 @@ func (dt DirTree) String() string {
|
||||||
return out.String()
|
return out.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func walkRDirTree(f Fs, path string, includeAll bool, maxLevel int, listR ListRFn) (DirTree, error) {
|
func walkRDirTree(f Fs, startPath string, includeAll bool, maxLevel int, listR ListRFn) (DirTree, error) {
|
||||||
dirs := make(DirTree)
|
dirs := make(DirTree)
|
||||||
var mu sync.Mutex
|
var mu sync.Mutex
|
||||||
err := listR(path, func(entries DirEntries) error {
|
err := listR(startPath, func(entries DirEntries) error {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
defer mu.Unlock()
|
defer mu.Unlock()
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
|
@ -367,7 +367,7 @@ func walkRDirTree(f Fs, path string, includeAll bool, maxLevel int, listR ListRF
|
||||||
for ; slashes > maxLevel-1; slashes-- {
|
for ; slashes > maxLevel-1; slashes-- {
|
||||||
dirPath = parentDir(dirPath)
|
dirPath = parentDir(dirPath)
|
||||||
}
|
}
|
||||||
dirs.checkParent(path, dirPath)
|
dirs.checkParent(startPath, dirPath)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Debugf(x, "Excluded from sync (and deletion)")
|
Debugf(x, "Excluded from sync (and deletion)")
|
||||||
|
@ -394,9 +394,9 @@ func walkRDirTree(f Fs, path string, includeAll bool, maxLevel int, listR ListRF
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
dirs.checkParents(path)
|
dirs.checkParents(startPath)
|
||||||
if len(dirs) == 0 {
|
if len(dirs) == 0 {
|
||||||
dirs[path] = nil
|
dirs[startPath] = nil
|
||||||
}
|
}
|
||||||
dirs.Sort()
|
dirs.Sort()
|
||||||
return dirs, nil
|
return dirs, nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue