mirror of
https://github.com/rclone/rclone.git
synced 2024-12-22 15:11:56 +01:00
fs: make ConfigFs take an fs.Info which makes it more useful
This commit is contained in:
parent
18e9d039ad
commit
021f25a748
10
fs/newfs.go
10
fs/newfs.go
@ -117,7 +117,7 @@ func ParseRemote(path string) (fsInfo *RegInfo, configName, fsPath string, conne
|
||||
|
||||
// configString returns a canonical version of the config string used
|
||||
// to configure the Fs as passed to fs.NewFs
|
||||
func configString(f Fs, full bool) string {
|
||||
func configString(f Info, full bool) string {
|
||||
name := f.Name()
|
||||
if open := strings.IndexRune(name, '{'); full && open >= 0 && strings.HasSuffix(name, "}") {
|
||||
suffix := name[open:]
|
||||
@ -140,10 +140,16 @@ func configString(f Fs, full bool) string {
|
||||
// ConfigString returns a canonical version of the config string used
|
||||
// to configure the Fs as passed to fs.NewFs. For Fs with extra
|
||||
// parameters this will include a canonical {hexstring} suffix.
|
||||
func ConfigString(f Fs) string {
|
||||
func ConfigString(f Info) string {
|
||||
return configString(f, false)
|
||||
}
|
||||
|
||||
// FullPath returns the full path with remote:path/to/object
|
||||
// for an object.
|
||||
func FullPath(o Object) string {
|
||||
return fspath.JoinRootPath(ConfigString(o.Fs()), o.Remote())
|
||||
}
|
||||
|
||||
// ConfigStringFull returns a canonical version of the config string
|
||||
// used to configure the Fs as passed to fs.NewFs. This string can be
|
||||
// used to re-instantiate the Fs exactly so includes all the extra
|
||||
|
Loading…
Reference in New Issue
Block a user