Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
os: Rename cannot move the file to a different disk drive #13766
go version go1.5.2 windows/386
After 92c5736 with MoveFileEx os.Rename("r:\1.txt", "z:\1.txt") on windows generate error:
So, syscall_windows.go Rename must be
Rename now uses MoveFileEx which was previously not available to use because it is not supported on Windows 2000. Change-Id: I583d029c4467c9be6d1574a790c423559b441e87 Reviewed-on: https://go-review.googlesource.com/6140 Reviewed-by: Brad Fitzpatrick <email@example.com> Run-TryBot: Brad Fitzpatrick <firstname.lastname@example.org>
os.Rename doesn't move a file to a different drive on Unix either. I don't see a good reason to use MOVEFILE_COPY_ALLOWED; this is rename, not copy. According to the docs MOVEFILE_COPY_ALLOWED can leave you with two copies of the file, which is not desirable.