mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 17:14:44 +01:00
parent
4ba58884b1
commit
0d4bff8239
8
cache/directory.go
vendored
8
cache/directory.go
vendored
@ -5,9 +5,7 @@ package cache
|
||||
import (
|
||||
"time"
|
||||
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
)
|
||||
@ -97,8 +95,10 @@ func (d *Directory) String() string {
|
||||
func (d *Directory) Remote() string {
|
||||
p := cleanPath(path.Join(d.Dir, d.Name))
|
||||
if d.CacheFs.Root() != "" {
|
||||
p = strings.Replace(p, d.CacheFs.Root(), "", 1)
|
||||
p = strings.TrimPrefix(p, string(os.PathSeparator))
|
||||
p = p[len(d.CacheFs.Root()):] // trim out root
|
||||
if len(p) > 0 { // remove first separator
|
||||
p = p[1:]
|
||||
}
|
||||
}
|
||||
|
||||
return p
|
||||
|
7
cache/object.go
vendored
7
cache/object.go
vendored
@ -7,7 +7,6 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -133,8 +132,10 @@ func (o *Object) String() string {
|
||||
func (o *Object) Remote() string {
|
||||
p := path.Join(o.Dir, o.Name)
|
||||
if o.CacheFs.Root() != "" {
|
||||
p = strings.Replace(p, o.CacheFs.Root(), "", 1)
|
||||
p = strings.TrimPrefix(p, string(os.PathSeparator))
|
||||
p = p[len(o.CacheFs.Root()):] // trim out root
|
||||
if len(p) > 0 { // remove first separator
|
||||
p = p[1:]
|
||||
}
|
||||
}
|
||||
|
||||
return p
|
||||
|
Loading…
Reference in New Issue
Block a user