Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=48397 Signed-off-by: Myah Caron qsniyg@protonmail.com --- programs/cmd/builtins.c | 15 +++++---------- programs/cmd/tests/test_builtins.cmd.exp | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 70ccddebc11..d2f2ea517a0 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -3003,6 +3003,7 @@ void WCMD_move (void) WCHAR src[MAX_PATH]; DWORD attribs; BOOL ok = TRUE; + DWORD flags = 0;
WINE_TRACE("Processing file '%s'\n", wine_dbgstr_w(fd.cFileName));
@@ -3051,20 +3052,14 @@ void WCMD_move (void) question = WCMD_format_string(WCMD_LoadMessage(WCMD_OVERWRITE), dest); ok = WCMD_ask_confirm(question, FALSE, NULL); LocalFree(question); - - /* So delete the destination prior to the move */ - if (ok) { - if (!DeleteFileW(dest)) { - WCMD_print_error (); - errorlevel = 1; - ok = FALSE; - } - } } + + if (ok) + flags |= MOVEFILE_REPLACE_EXISTING; }
if (ok) { - status = MoveFileW(src, dest); + status = MoveFileExW(src, dest, flags); } else { status = TRUE; } diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index fb84de2f5d5..f75839fdbe8 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1343,8 +1343,8 @@ original file still present ------------ Testing move ------------ --- file move file move succeeded -@todo_wine@file move with overwrite succeeded@or_broken@file overwrite impossible! -@todo_wine@bar@or_broken@baz +file move with overwrite succeeded@or_broken@file overwrite impossible! +bar@or_broken@baz read-only files are moveable file moved in subdirectory moving a file to itself is a no-op@or_broken@moving a file to itself should be a no-op! -- 2.28.0