Commit ebb0ecaf authored by Dominic Della Valle's avatar Dominic Della Valle

Change go-os-rename to standard

Since Go 1.5, os.Rename is consistent across platforms
parent 542131a8
......@@ -13,7 +13,6 @@ import (
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/query"
"github.com/jbenet/go-os-rename"
)
func UpgradeV0toV1(path string, prefixLen int) error {
......@@ -152,7 +151,7 @@ func Move(oldPath string, newPath string, out io.Writer) error {
// else we found something unexpected, so to be safe just move it
log.Warningf("found unexpected file in datastore directory: \"%s\", moving anyway\n", fn)
newPath := filepath.Join(newDS.path, fn)
err := osrename.Rename(oldPath, newPath)
err := os.Rename(oldPath, newPath)
if err != nil {
return err
}
......@@ -173,7 +172,7 @@ func moveKey(oldDS *Datastore, newDS *Datastore, key datastore.Key) error {
if err != nil {
return err
}
err = osrename.Rename(oldPath, newPath)
err = os.Rename(oldPath, newPath)
if err != nil {
return err
}
......
......@@ -19,7 +19,6 @@ import (
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/query"
"github.com/jbenet/go-os-rename"
logging "github.com/ipfs/go-log"
)
......@@ -286,7 +285,7 @@ func (fs *Datastore) renameAndUpdateDiskUsage(tmpPath, path string) error {
// Rename and add new file's diskUsage. If the rename fails,
// it will either a) Re-add the size of an existing file, which
// was sustracted before b) Add 0 if there is no existing file.
err = osrename.Rename(tmpPath, path)
err = os.Rename(tmpPath, path)
fs.updateDiskUsage(path, true)
return err
}
......@@ -779,7 +778,7 @@ func (fs *Datastore) persistDiskUsageFile() {
return
}
osrename.Rename(tmp.Name(), filepath.Join(fs.path, DiskUsageFile))
os.Rename(tmp.Name(), filepath.Join(fs.path, DiskUsageFile))
}
func (fs *Datastore) readDiskUsageFile() int64 {
......
......@@ -12,12 +12,6 @@
"name": "go-log",
"version": "1.4.0"
},
{
"author": "jbenet",
"hash": "QmaeRR9SpXumU5tYLRkq6x6pfMe8qKzxn4ujBpsTJ2zQG7",
"name": "go-os-rename",
"version": "0.0.0"
},
{
"author": "jbenet",
"hash": "QmeiCcJfDW1GJnWUArudsv5rQsihpi4oyddPhdqo3CfX6i",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment