Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

vfs: add open files to directories

Nick Craig-Woodeab55ce8829d
diff --git a/vfs/read_write.go b/vfs/read_write.go
index b8a0f2bab..b42d4f36e 100644
--- a/vfs/read_write.go
+++ b/vfs/read_write.go
@@ -104,6 +104,7 @@ func (fh *RWFileHandle) openPending(truncate bool) (err error) {
fh.File = fd
fh.opened = true
fh.d.vfs.cache.open(fh.osPath)
+ fh.d.addObject(fh.file) // make sure the directory has this object in it now
return nil
}
diff --git a/vfs/write.go b/vfs/write.go
index b7de11ae2..ce9d6b914 100644
--- a/vfs/write.go
+++ b/vfs/write.go
@@ -51,6 +51,7 @@ func newWriteFileHandle(d *Dir, f *File, remote string) (*WriteFileHandle, error
}()
fh.file.addWriter(fh)
fh.file.setSize(0)
+ d.addObject(fh.file) // make sure the directory has this object in it now
return fh, nil
}