-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs::rename
behavior differs on windows
#15836
Comments
Actually, looking at the sources, the Windows implementation is surprising to me. The Windows implementation of
And the documentation of MOVEFILE_REPLACE_EXISTING
The Unix implementation succeeds because the target directory can be overwritten if it is empty: So |
The equivalent python and Java programs succeed on Linux, so perhaps success is the correct result. |
The 'only if the directory is empty' rule is pretty bizarre. Is that really the cross-platform rule we want? |
I've been rethinking the modification to |
It seems like there's a lot of precedent for unifying I/O semantics from other languages though. |
FWIW Python's rename fails on Windows if the destination path exists: https://docs.python.org/2/library/os.html#os.rename |
With the I/O reform having happened since this was opened, I'm going to close this as "not a bug" |
What is the behavior now? |
We just shell out to the system call and reexport that behavior. |
This program will succeed on unix but fail to succeed on windows. The unix behavior is surprising to me!
The text was updated successfully, but these errors were encountered: