fs: make ConfigFs take an fs.Info which makes it more useful

This commit is contained in:
Nick Craig-Wood 2023-09-02 18:13:42 +01:00
parent 18e9d039ad
commit 021f25a748

View File

@ -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