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