mirror of
https://github.com/rclone/rclone.git
synced 2025-02-04 05:08:23 +02:00
fs: add ConfigString function to return a canonical config string
This commit is contained in:
parent
b52a39a84e
commit
ca1856724c
11
fs/fs.go
11
fs/fs.go
@ -1331,6 +1331,17 @@ func NewFs(path string) (Fs, error) {
|
|||||||
return fsInfo.NewFs(configName, fsPath, config)
|
return fsInfo.NewFs(configName, fsPath, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ConfigString returns a canonical version of the config string used
|
||||||
|
// to configure the Fs as passed to fs.NewFs
|
||||||
|
func ConfigString(f Fs) string {
|
||||||
|
name := f.Name()
|
||||||
|
root := f.Root()
|
||||||
|
if name == "local" && f.Features().IsLocal {
|
||||||
|
return root
|
||||||
|
}
|
||||||
|
return name + ":" + root
|
||||||
|
}
|
||||||
|
|
||||||
// TemporaryLocalFs creates a local FS in the OS's temporary directory.
|
// TemporaryLocalFs creates a local FS in the OS's temporary directory.
|
||||||
//
|
//
|
||||||
// No cleanup is performed, the caller must call Purge on the Fs themselves.
|
// No cleanup is performed, the caller must call Purge on the Fs themselves.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user