"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
local: fix renaming/deleting open files on Windows #2730
Nick Craig-Woodd08453d40240
diff --git a/backend/local/local.go b/backend/local/local.goindex 5ffee86ad..d86951720 100644--- a/backend/local/local.go+++ b/backend/local/local.go@@ -21,6 +21,7 @@ import ("github.com/ncw/rclone/fs/config/configstruct""github.com/ncw/rclone/fs/fserrors""github.com/ncw/rclone/fs/hash"+ "github.com/ncw/rclone/lib/file""github.com/ncw/rclone/lib/readers""github.com/pkg/errors")@@ -651,7 +652,7 @@ func (o *Object) Hash(r hash.Type) (string, error) {o.fs.objectHashesMu.Unlock()if !o.modTime.Equal(oldtime) || oldsize != o.size || hashes == nil {- in, err := os.Open(o.path)+ in, err := file.Open(o.path)if err != nil {return "", errors.Wrap(err, "hash: failed to open")}@@ -780,7 +781,7 @@ func (o *Object) Open(options ...fs.OpenOption) (in io.ReadCloser, err error) {}}- fd, err := os.Open(o.path)+ fd, err := file.Open(o.path)if err != nil {return}@@ -826,7 +827,7 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOptioreturn err}- out, err := os.OpenFile(o.path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)+ out, err := file.OpenFile(o.path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)if err != nil {return err}diff --git a/backend/local/local_internal_test.go b/backend/local/local_internal_test.goindex d69e7cf22..fc86010af 100644--- a/backend/local/local_internal_test.go+++ b/backend/local/local_internal_test.go@@ -1,13 +1,13 @@package localimport (- "os""path""testing""time""github.com/ncw/rclone/fs/hash""github.com/ncw/rclone/fstest"+ "github.com/ncw/rclone/lib/file""github.com/ncw/rclone/lib/readers""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"@@ -38,7 +38,7 @@ func TestUpdatingCheck(t *testing.T) {filePath := "sub dir/local test"r.WriteFile(filePath, "content", time.Now())- fd, err := os.Open(path.Join(r.LocalName, filePath))+ fd, err := file.Open(path.Join(r.LocalName, filePath))if err != nil {t.Fatalf("failed opening file %q: %v", filePath, err)}