SetModTime sets the modtime for the file if NoModTime is set then it does nothing
(modTime time.Time)
| 456 | // |
| 457 | // if NoModTime is set then it does nothing |
| 458 | func (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 |
nothing calls this directly
no test coverage detected