mirror of
https://github.com/rclone/rclone.git
synced 2025-01-03 12:59:32 +01:00
Add Root() to Fs interface
This commit is contained in:
parent
cbc6bf6a89
commit
92745aa950
@ -160,6 +160,11 @@ func (f *FsDrive) Name() string {
|
|||||||
return f.name
|
return f.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The root of the remote (as passed into NewFs)
|
||||||
|
func (f *FsDrive) Root() string {
|
||||||
|
return f.root
|
||||||
|
}
|
||||||
|
|
||||||
// String converts this FsDrive to a string
|
// String converts this FsDrive to a string
|
||||||
func (f *FsDrive) String() string {
|
func (f *FsDrive) String() string {
|
||||||
return fmt.Sprintf("Google drive root '%s'", f.root)
|
return fmt.Sprintf("Google drive root '%s'", f.root)
|
||||||
|
@ -114,6 +114,11 @@ func (f *FsDropbox) Name() string {
|
|||||||
return f.name
|
return f.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The root of the remote (as passed into NewFs)
|
||||||
|
func (f *FsDropbox) Root() string {
|
||||||
|
return f.root
|
||||||
|
}
|
||||||
|
|
||||||
// String converts this FsDropbox to a string
|
// String converts this FsDropbox to a string
|
||||||
func (f *FsDropbox) String() string {
|
func (f *FsDropbox) String() string {
|
||||||
return fmt.Sprintf("Dropbox root '%s'", f.root)
|
return fmt.Sprintf("Dropbox root '%s'", f.root)
|
||||||
|
3
fs/fs.go
3
fs/fs.go
@ -70,6 +70,9 @@ type Fs interface {
|
|||||||
// The name of the remote (as passed into NewFs)
|
// The name of the remote (as passed into NewFs)
|
||||||
Name() string
|
Name() string
|
||||||
|
|
||||||
|
// The root of the remote (as passed into NewFs)
|
||||||
|
Root() string
|
||||||
|
|
||||||
// String returns a description of the FS
|
// String returns a description of the FS
|
||||||
String() string
|
String() string
|
||||||
|
|
||||||
|
@ -26,6 +26,11 @@ func (f *Limited) Name() string {
|
|||||||
return f.fs.Name() // return name of underlying remote
|
return f.fs.Name() // return name of underlying remote
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The root of the remote (as passed into NewFs)
|
||||||
|
func (f *Limited) Root() string {
|
||||||
|
return f.fs.Root() // return root of underlying remote
|
||||||
|
}
|
||||||
|
|
||||||
// String returns a description of the FS
|
// String returns a description of the FS
|
||||||
func (f *Limited) String() string {
|
func (f *Limited) String() string {
|
||||||
return fmt.Sprintf("%s limited to %d objects", f.fs.String(), len(f.objects))
|
return fmt.Sprintf("%s limited to %d objects", f.fs.String(), len(f.objects))
|
||||||
|
@ -149,6 +149,14 @@ func (f *FsStorage) Name() string {
|
|||||||
return f.name
|
return f.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The root of the remote (as passed into NewFs)
|
||||||
|
func (f *FsStorage) Root() string {
|
||||||
|
if f.root == "" {
|
||||||
|
return f.bucket
|
||||||
|
}
|
||||||
|
return f.bucket + "/" + f.root
|
||||||
|
}
|
||||||
|
|
||||||
// String converts this FsStorage to a string
|
// String converts this FsStorage to a string
|
||||||
func (f *FsStorage) String() string {
|
func (f *FsStorage) String() string {
|
||||||
if f.root == "" {
|
if f.root == "" {
|
||||||
|
@ -77,6 +77,11 @@ func (f *FsLocal) Name() string {
|
|||||||
return f.name
|
return f.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The root of the remote (as passed into NewFs)
|
||||||
|
func (f *FsLocal) Root() string {
|
||||||
|
return f.root
|
||||||
|
}
|
||||||
|
|
||||||
// String converts this FsLocal to a string
|
// String converts this FsLocal to a string
|
||||||
func (f *FsLocal) String() string {
|
func (f *FsLocal) String() string {
|
||||||
return fmt.Sprintf("Local file system at %s", f.root)
|
return fmt.Sprintf("Local file system at %s", f.root)
|
||||||
|
8
s3/s3.go
8
s3/s3.go
@ -158,6 +158,14 @@ func (f *FsS3) Name() string {
|
|||||||
return f.name
|
return f.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The root of the remote (as passed into NewFs)
|
||||||
|
func (f *FsS3) Root() string {
|
||||||
|
if f.root == "" {
|
||||||
|
return f.bucket
|
||||||
|
}
|
||||||
|
return f.bucket + "/" + f.root
|
||||||
|
}
|
||||||
|
|
||||||
// String converts this FsS3 to a string
|
// String converts this FsS3 to a string
|
||||||
func (f *FsS3) String() string {
|
func (f *FsS3) String() string {
|
||||||
if f.root == "" {
|
if f.root == "" {
|
||||||
|
@ -81,6 +81,14 @@ func (f *FsSwift) Name() string {
|
|||||||
return f.name
|
return f.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The root of the remote (as passed into NewFs)
|
||||||
|
func (f *FsSwift) Root() string {
|
||||||
|
if f.root == "" {
|
||||||
|
return f.container
|
||||||
|
}
|
||||||
|
return f.container + "/" + f.root
|
||||||
|
}
|
||||||
|
|
||||||
// String converts this FsSwift to a string
|
// String converts this FsSwift to a string
|
||||||
func (f *FsSwift) String() string {
|
func (f *FsSwift) String() string {
|
||||||
if f.root == "" {
|
if f.root == "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user