MCPcopy
hub / github.com/rclone/rclone / ShallowDirectory

Function ShallowDirectory

backend/cache/directory.go:38–56  ·  view source on GitHub ↗

ShallowDirectory builds an empty dir which will be used to unmarshal data in it

(f *Fs, remote string)

Source from the content-addressed store, hash-verified

36
37// ShallowDirectory builds an empty dir which will be used to unmarshal data in it
38func ShallowDirectory(f *Fs, remote string) *Directory {
39 var cd *Directory
40 fullRemote := cleanPath(path.Join(f.Root(), remote))
41
42 // build a new one
43 dir := cleanPath(path.Dir(fullRemote))
44 name := cleanPath(path.Base(fullRemote))
45 cd = &Directory{
46 CacheFs: f,
47 Name: name,
48 Dir: dir,
49 CacheModTime: time.Now().UnixNano(),
50 CacheSize: 0,
51 CacheItems: 0,
52 CacheType: "Directory",
53 }
54
55 return cd
56}
57
58// DirectoryFromOriginal builds one from a generic fs.Directory
59func DirectoryFromOriginal(ctx context.Context, f *Fs, d fs.Directory) *Directory {

Callers 2

ListMethod · 0.85
NewDirectoryFunction · 0.85

Calls 5

cleanPathFunction · 0.85
JoinMethod · 0.80
DirMethod · 0.80
BaseMethod · 0.80
RootMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…