"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
mount: report the modification times for directories from the remote #940 #950
Nick Craig-Wood13b705e22713
diff --git a/cmd/mount/dir.go b/cmd/mount/dir.goindex e6787c2af..4e9761376 100644--- a/cmd/mount/dir.go+++ b/cmd/mount/dir.go@@ -27,17 +27,19 @@ type DirEntry struct {// Dir represents a directory entrytype Dir struct {- f fs.Fs- path string- mu sync.RWMutex // protects the following- read time.Time // time directory entry last read- items map[string]*DirEntry+ f fs.Fs+ path string+ modTime time.Time+ mu sync.RWMutex // protects the following+ read time.Time // time directory entry last read+ items map[string]*DirEntry}-func newDir(f fs.Fs, path string) *Dir {+func newDir(f fs.Fs, fsDir *fs.Dir) *Dir {return &Dir{- f: f,- path: path,+ f: f,+ path: fsDir.Name,+ modTime: fsDir.When,}}@@ -154,6 +156,10 @@ func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) error {a.Gid = gida.Uid = uida.Mode = os.ModeDir | dirPerms+ a.Atime = d.modTime+ a.Mtime = d.modTime+ a.Ctime = d.modTime+ a.Crtime = d.modTime// FIXME include Valid so get some caching? Also mtimereturn nil}@@ -172,7 +178,7 @@ func (d *Dir) lookupNode(leaf string) (item *DirEntry, err error) {case fs.Object:node, err = newFile(d, x), nilcase *fs.Dir:- node, err = newDir(d.f, x.Remote()), nil+ node, err = newDir(d.f, x), nildefault:err = errors.Errorf("unknown type %T", item)}@@ -275,7 +281,7 @@ func (d *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fusefs.Node, eName: path,When: time.Now(),}- dir := newDir(d.f, path)+ dir := newDir(d.f, fsDir)d.addObject(fsDir, dir)fs.Debug(path, "Dir.Mkdir OK")return dir, nildiff --git a/cmd/mount/fs.go b/cmd/mount/fs.goindex 0e63e7557..7e1f10987 100644--- a/cmd/mount/fs.go+++ b/cmd/mount/fs.go@@ -5,6 +5,8 @@package mountimport (+ "time"+"bazil.org/fuse"fusefs "bazil.org/fuse/fs""github.com/ncw/rclone/fs"@@ -22,7 +24,11 @@ var _ fusefs.FS = (*FS)(nil)// Root returns the root nodefunc (f *FS) Root() (fusefs.Node, error) {fs.Debug(f.f, "Root()")- return newDir(f.f, ""), nil+ fsDir := &fs.Dir{+ Name: "",+ When: time.Now(),+ }+ return newDir(f.f, fsDir), nil}// mountOptions configures the options from the command line flags