Commit 81fe7a21 authored by Myah Caron's avatar Myah Caron Committed by Alexandre Julliard

cmd.exe: Fix /Y flag for move builtin.

parent fc1bb9af
...@@ -3003,6 +3003,7 @@ void WCMD_move (void) ...@@ -3003,6 +3003,7 @@ void WCMD_move (void)
WCHAR src[MAX_PATH]; WCHAR src[MAX_PATH];
DWORD attribs; DWORD attribs;
BOOL ok = TRUE; BOOL ok = TRUE;
DWORD flags = 0;
WINE_TRACE("Processing file '%s'\n", wine_dbgstr_w(fd.cFileName)); WINE_TRACE("Processing file '%s'\n", wine_dbgstr_w(fd.cFileName));
...@@ -3051,20 +3052,14 @@ void WCMD_move (void) ...@@ -3051,20 +3052,14 @@ void WCMD_move (void)
question = WCMD_format_string(WCMD_LoadMessage(WCMD_OVERWRITE), dest); question = WCMD_format_string(WCMD_LoadMessage(WCMD_OVERWRITE), dest);
ok = WCMD_ask_confirm(question, FALSE, NULL); ok = WCMD_ask_confirm(question, FALSE, NULL);
LocalFree(question); 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) { if (ok) {
status = MoveFileW(src, dest); status = MoveFileExW(src, dest, flags);
} else { } else {
status = TRUE; status = TRUE;
} }
......
...@@ -1343,8 +1343,8 @@ original file still present ...@@ -1343,8 +1343,8 @@ original file still present
------------ Testing move ------------ ------------ Testing move ------------
--- file move --- file move
file move succeeded file move succeeded
@todo_wine@file move with overwrite succeeded@or_broken@file overwrite impossible! file move with overwrite succeeded@or_broken@file overwrite impossible!
@todo_wine@bar@or_broken@baz bar@or_broken@baz
read-only files are moveable read-only files are moveable
file moved in subdirectory 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! moving a file to itself is a no-op@or_broken@moving a file to itself should be a no-op!
......
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