1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

vfs: add Path method to Node and use it to stop reading nil DirEntry

All DirEntry calls now have been checked for nil or converted to use Path.
This commit is contained in:
Nick Craig-Wood
2017-11-18 11:47:21 +00:00
parent 7c3584f4e6
commit c560017934
8 changed files with 46 additions and 38 deletions

View File

@@ -61,6 +61,7 @@ type Node interface {
VFS() *VFS
Open(flags int) (Handle, error)
Truncate(size int64) error
Path() string
}
// Check interfaces
@@ -75,7 +76,7 @@ type Nodes []Node
// Sort functions
func (ns Nodes) Len() int { return len(ns) }
func (ns Nodes) Swap(i, j int) { ns[i], ns[j] = ns[j], ns[i] }
func (ns Nodes) Less(i, j int) bool { return ns[i].DirEntry().Remote() < ns[j].DirEntry().Remote() }
func (ns Nodes) Less(i, j int) bool { return ns[i].Path() < ns[j].Path() }
// Noder represents something which can return a node
type Noder interface {