From b012205b2e1a78b3cf336934f289891477b8c414 Mon Sep 17 00:00:00 2001 From: genotrance Date: Sat, 23 May 2020 11:06:04 -0500 Subject: [PATCH] Fix #14057 - moveFile should overwrite on Windows (#14433) --- lib/pure/os.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 449ae1d841..fbd722863e 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1801,9 +1801,9 @@ proc tryMoveFSObject(source, dest: string): bool {.noNimScript.} = when useWinUnicode: let s = newWideCString(source) let d = newWideCString(dest) - if moveFileExW(s, d, MOVEFILE_COPY_ALLOWED) == 0'i32: raiseOSError(osLastError(), $(source, dest)) + if moveFileExW(s, d, MOVEFILE_COPY_ALLOWED or MOVEFILE_REPLACE_EXISTING) == 0'i32: raiseOSError(osLastError(), $(source, dest)) else: - if moveFileExA(source, dest, MOVEFILE_COPY_ALLOWED) == 0'i32: raiseOSError(osLastError(), $(source, dest)) + if moveFileExA(source, dest, MOVEFILE_COPY_ALLOWED or MOVEFILE_REPLACE_EXISTING) == 0'i32: raiseOSError(osLastError(), $(source, dest)) else: if c_rename(source, dest) != 0'i32: let err = osLastError()