MCPcopy
hub / github.com/rclone/rclone / Stat

Method Stat

cmd/tree/tree.go:214–227  ·  view source on GitHub ↗

Stat returns info about the file

(filePath string)

Source from the content-addressed store, hash-verified

212
213// Stat returns info about the file
214func (dirs Fs) Stat(filePath string) (fi os.FileInfo, err error) {
215 defer log.Trace(nil, "filePath=%q", filePath)("fi=%+v, err=%v", &fi, &err)
216 filePath = filepath.ToSlash(filePath)
217 filePath = enc.ToStandardPath(filePath)
218 filePath = strings.TrimLeft(filePath, "/")
219 if filePath == "" {
220 return &FileInfo{fs.NewDir("", time.Now())}, nil
221 }
222 _, entry := dirtree.DirTree(dirs).Find(filePath)
223 if entry == nil {
224 return nil, fmt.Errorf("couldn't find %q in directory cache", filePath)
225 }
226 return &FileInfo{entry}, nil
227}
228
229// ReadDir returns info about the directory and fills up the directory cache
230func (dirs Fs) ReadDir(dir string) (names []string, err error) {

Callers

nothing calls this directly

Calls 6

TraceFunction · 0.92
NewDirFunction · 0.92
DirTreeTypeAlias · 0.92
ToStandardPathMethod · 0.65
FindMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected