MCPcopy
hub / github.com/rclone/rclone / SetModTime

Method SetModTime

vfs/file.go:458–482  ·  view source on GitHub ↗

SetModTime sets the modtime for the file if NoModTime is set then it does nothing

(modTime time.Time)

Source from the content-addressed store, hash-verified

456//
457// if NoModTime is set then it does nothing
458func (f *File) SetModTime(modTime time.Time) error {
459 f.mu.Lock()
460 defer f.mu.Unlock()
461 if f.d.vfs.Opt.NoModTime {
462 return nil
463 }
464 if f.d.vfs.Opt.ReadOnly {
465 return EROFS
466 }
467
468 f.pendingModTime = modTime
469
470 // set the time of the file in the cache
471 if f.d.vfs.cache != nil && f.d.vfs.cache.Exists(f._cachePath()) {
472 f.d.vfs.cache.SetModTime(f._cachePath(), f.pendingModTime)
473 }
474
475 // Only update the ModTime when there are no writers, setObject will do it
476 if !f._writingInProgress() {
477 return f._applyPendingModTime()
478 }
479
480 // queue up for later, hoping f.o becomes available
481 return nil
482}
483
484// Apply a pending mod time
485// Call with the mutex held

Callers

nothing calls this directly

Calls 7

_cachePathMethod · 0.95
_writingInProgressMethod · 0.95
_applyPendingModTimeMethod · 0.95
LockMethod · 0.65
UnlockMethod · 0.65
SetModTimeMethod · 0.65
ExistsMethod · 0.45

Tested by

no test coverage detected