forked from TrueCloudLab/rclone
fs: make ConfigFs take an fs.Info which makes it more useful
This commit is contained in:
parent
18e9d039ad
commit
021f25a748
1 changed files with 8 additions and 2 deletions
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
|
// configString returns a canonical version of the config string used
|
||||||
// to configure the Fs as passed to fs.NewFs
|
// 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()
|
name := f.Name()
|
||||||
if open := strings.IndexRune(name, '{'); full && open >= 0 && strings.HasSuffix(name, "}") {
|
if open := strings.IndexRune(name, '{'); full && open >= 0 && strings.HasSuffix(name, "}") {
|
||||||
suffix := name[open:]
|
suffix := name[open:]
|
||||||
|
@ -140,10 +140,16 @@ func configString(f Fs, full bool) string {
|
||||||
// ConfigString returns a canonical version of the config string used
|
// ConfigString returns a canonical version of the config string used
|
||||||
// to configure the Fs as passed to fs.NewFs. For Fs with extra
|
// to configure the Fs as passed to fs.NewFs. For Fs with extra
|
||||||
// parameters this will include a canonical {hexstring} suffix.
|
// parameters this will include a canonical {hexstring} suffix.
|
||||||
func ConfigString(f Fs) string {
|
func ConfigString(f Info) string {
|
||||||
return configString(f, false)
|
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
|
// 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 configure the Fs as passed to fs.NewFs. This string can be
|
||||||
// used to re-instantiate the Fs exactly so includes all the extra
|
// used to re-instantiate the Fs exactly so includes all the extra
|
||||||
|
|
Loading…
Add table
Reference in a new issue