Commit 812905a6 authored by Rob Jonson's avatar Rob Jonson Committed by Rémi Denis-Courmont

Update windows rename function to correctly deal with pre-existing files.

Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 900ad522
...@@ -230,7 +230,7 @@ int vlc_rename (const char *oldpath, const char *newpath) ...@@ -230,7 +230,7 @@ int vlc_rename (const char *oldpath, const char *newpath)
/* FIXME: errno support */ /* FIXME: errno support */
return MoveFileW (wold, wnew) ? 0 : -1; return MoveFileW (wold, wnew) ? 0 : -1;
#else #else
if (_wrename (wold, wnew) && errno == EACCES) if (_wrename (wold, wnew) && (errno == EACCES || errno == EEXIST))
{ /* Windows does not allow atomic file replacement */ { /* Windows does not allow atomic file replacement */
if (_wremove (wnew)) if (_wremove (wnew))
{ {
......
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