vfs: add open files to directories

This commit is contained in:
Nick Craig-Wood 2017-11-18 11:53:22 +00:00
parent 61b6159a05
commit eab55ce882
2 changed files with 2 additions and 0 deletions

View File

@ -104,6 +104,7 @@ func (fh *RWFileHandle) openPending(truncate bool) (err error) {
fh.File = fd fh.File = fd
fh.opened = true fh.opened = true
fh.d.vfs.cache.open(fh.osPath) fh.d.vfs.cache.open(fh.osPath)
fh.d.addObject(fh.file) // make sure the directory has this object in it now
return nil return nil
} }

View File

@ -51,6 +51,7 @@ func newWriteFileHandle(d *Dir, f *File, remote string) (*WriteFileHandle, error
}() }()
fh.file.addWriter(fh) fh.file.addWriter(fh)
fh.file.setSize(0) fh.file.setSize(0)
d.addObject(fh.file) // make sure the directory has this object in it now
return fh, nil return fh, nil
} }