mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 17:14:44 +01:00
parent
3b5e70c8c6
commit
98bf65c43b
12
vfs/vfs.go
12
vfs/vfs.go
@ -224,7 +224,7 @@ func New(f fs.Fs, opt *Options) *VFS {
|
||||
// Start polling if required
|
||||
if vfs.Opt.PollInterval > 0 {
|
||||
if do := vfs.f.Features().ChangeNotify; do != nil {
|
||||
do(vfs.root.ForgetPath, vfs.Opt.PollInterval)
|
||||
do(vfs.notifyFunc, vfs.Opt.PollInterval)
|
||||
} else {
|
||||
fs.Infof(f, "poll-interval is not supported by this remote")
|
||||
}
|
||||
@ -495,3 +495,13 @@ func (vfs *VFS) Statfs() (total, used, free int64) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// notifyFunc removes the last path segement for directories and calls ForgetPath with the result.
|
||||
//
|
||||
// This ensures that new or renamed directories appear in their parent.
|
||||
func (vfs *VFS) notifyFunc(relativePath string, entryType fs.EntryType) {
|
||||
if entryType == fs.EntryDirectory {
|
||||
relativePath = path.Dir(relativePath)
|
||||
}
|
||||
vfs.root.ForgetPath(relativePath, entryType)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user