Add Name() to Fs interface to return name as passed to NewFs

This commit is contained in:
Nick Craig-Wood
2015-08-23 13:36:38 +01:00
parent 0c6f816a49
commit fedf81c2b7
8 changed files with 51 additions and 1 deletions
+8 -1
View File
@@ -104,6 +104,7 @@ func configHelper(name string) {
// FsDropbox represents a remote dropbox server
type FsDropbox struct {
name string // name of this remote
db *dropbox.Dropbox // the connection to the dropbox server
root string // the path we are working on
slashRoot string // root with "/" prefix, lowercase
@@ -121,6 +122,11 @@ type FsObjectDropbox struct {
// ------------------------------------------------------------
// The name of the remote (as passed into NewFs)
func (f *FsDropbox) Name() string {
return f.name
}
// String converts this FsDropbox to a string
func (f *FsDropbox) String() string {
return fmt.Sprintf("Dropbox root '%s'", f.root)
@@ -148,7 +154,8 @@ func newDropbox(name string) *dropbox.Dropbox {
func NewFs(name, root string) (fs.Fs, error) {
db := newDropbox(name)
f := &FsDropbox{
db: db,
name: name,
db: db,
}
f.setRoot(root)