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

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48397
Signed-off-by: Myah Caron <qsniyg@protonmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Myah Caron 2020-09-10 19:10:55 +00:00 committed by Alexandre Julliard
parent fc1bb9aff5
commit 81fe7a2165
2 changed files with 7 additions and 12 deletions

View File

@ -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;
}

View File

@ -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!