1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-04 17:43:50 +00:00

Add a directory parameter to Fs.List()

This commit is contained in:
Nick Craig-Wood
2016-04-23 21:46:52 +01:00
parent 753b0717be
commit 68ec6a9f5b
31 changed files with 263 additions and 230 deletions

View File

@@ -8,6 +8,8 @@ import (
"log"
"strings"
"sync"
"github.com/ncw/rclone/fs"
)
// DirCache caches paths to directory IDs and vice versa
@@ -160,7 +162,7 @@ func (dc *DirCache) _findDir(path string, create bool) (pathID string, err error
return "", fmt.Errorf("Failed to make directory: %v", err)
}
} else {
return "", fmt.Errorf("Couldn't find directory: %q", path)
return "", fs.ErrorDirNotFound
}
}
@@ -179,13 +181,6 @@ func (dc *DirCache) FindPath(path string, create bool) (leaf, directoryID string
defer dc.mu.Unlock()
directory, leaf := SplitPath(path)
directoryID, err = dc._findDir(directory, create)
if err != nil {
if create {
err = fmt.Errorf("Couldn't find or make directory %q: %s", directory, err)
} else {
err = fmt.Errorf("Couldn't find directory %q: %s", directory, err)
}
}
return
}