onedrive, drive, amazonclouddrive: make sure we find the root

This fixes copyto copying things to the wrong place - fixes #1231
This commit is contained in:
Nick Craig-Wood
2017-03-16 09:42:49 +00:00
parent 986a2851bf
commit 9b07d32c02
5 changed files with 16 additions and 29 deletions
+11
View File
@@ -243,6 +243,17 @@ func (dc *DirCache) FindRoot(create bool) error {
return nil
}
// FindRootAndPath finds the root first if not found then finds leaf and directoryID from a path
//
// If create is set parent directories will be created if they don't exist
func (dc *DirCache) FindRootAndPath(path string, create bool) (leaf, directoryID string, err error) {
err = dc.FindRoot(create)
if err != nil {
return
}
return dc.FindPath(path, create)
}
// FoundRoot returns whether the root directory has been found yet
//
// Call this from FindLeaf or CreateDir only