Skip to content

Commit

Permalink
flatfs: Windows os.Rename refuses to overwrite a file; call MoveFiles…
Browse files Browse the repository at this point in the history
…Ex directly

For background, see golang/go#3366

Here's the failure seen:

    --- FAIL: TestPutOverwrite (0.03s)
    	flatfs_test.go:118: Put fail: rename C:\Users\gates\AppData\Local\Temp\test-datastore-flatfs-679014441\7175\put- 717454915 C:\Users\gates\AppData\Local\Temp\test-datastore-flatfs-679014441/7175/71757578.data: Cannot create a file when that file already exists.
  • Loading branch information
tv42 committed Apr 25, 2015
1 parent a3d1eea commit 58d30fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flatfs/flatfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"strings"

"github.com/jbenet/go-datastore"
"github.com/jbenet/go-datastore/Godeps/_workspace/src/github.com/jbenet/go-os-rename"
"github.com/jbenet/go-datastore/query"
)

Expand Down Expand Up @@ -124,7 +125,7 @@ func (fs *Datastore) Put(key datastore.Key, value interface{}) error {
}
closed = true

err = os.Rename(tmp.Name(), path)
err = osrename.Rename(tmp.Name(), path)
if err != nil {
return err
}
Expand Down

0 comments on commit 58d30fe

Please sign in to comment.