Do not remove the file when renaming on a case-insensitive platform (fixes #1743)

This commit is contained in:
Lode Hoste
2015-05-01 13:06:11 +02:00
parent 58b15f9452
commit 67f0c9bef0
2 changed files with 14 additions and 10 deletions

View File

@@ -172,7 +172,7 @@ func alterFiles(dir string) error {
base[i] = unicode.ToUpper(r)
}
}
err = os.Rename(path, strings.Replace(path, filepath.Base(path), string(base), 1))
err = osutil.TryRename(path, strings.Replace(path, filepath.Base(path), string(base), 1))
return err
// Switch between files and directories
@@ -188,7 +188,7 @@ func alterFiles(dir string) error {
return err
}
} else {
err := os.Remove(path)
err := osutil.Remove(path)
if err != nil {
return err
}
@@ -207,7 +207,7 @@ func alterFiles(dir string) error {
rpath = filepath.Join(rpath, "..")
}
}
err = os.Rename(path, filepath.Join(rpath, randomName()))
err = osutil.TryRename(path, filepath.Join(rpath, randomName()))
return err
}
return nil