diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/win32/win32.c b/win32/win32.c index 7e151d498e..c284194577 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4344,18 +4344,9 @@ wrename(const WCHAR *oldpath, const WCHAR *newpath) if (newatts != -1 && newatts & FILE_ATTRIBUTE_READONLY) SetFileAttributesW(newpath, newatts & ~ FILE_ATTRIBUTE_READONLY); - if (!MoveFileW(oldpath, newpath)) + if (!MoveFileExW(oldpath, newpath, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED)) res = -1; - if (res) { - switch (GetLastError()) { - case ERROR_ALREADY_EXISTS: - case ERROR_FILE_EXISTS: - if (MoveFileExW(oldpath, newpath, MOVEFILE_REPLACE_EXISTING)) - res = 0; - } - } - if (res) errno = map_errno(GetLastError()); else |