Commit d1790c98 authored by Myah Caron's avatar Myah Caron Committed by Alexandre Julliard

cmd.exe: Don't prompt for move when non-interactive.

Based on a patch by Francesco Noferi. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48396Signed-off-by: 's avatarMyah Caron <qsniyg@protonmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 81fe7a21
...@@ -3033,15 +3033,28 @@ void WCMD_move (void) ...@@ -3033,15 +3033,28 @@ void WCMD_move (void)
WCHAR copycmd[MAXSTRING]; WCHAR copycmd[MAXSTRING];
DWORD len; DWORD len;
/* /-Y has the highest priority, then /Y and finally the COPYCMD env. variable */ /* Default whether automatic overwriting is on. If we are interactive then
we prompt by default, otherwise we overwrite by default
/-Y has the highest priority, then /Y and finally the COPYCMD env. variable */
if (wcsstr (quals, parmNoY)) if (wcsstr (quals, parmNoY))
force = FALSE; force = FALSE;
else if (wcsstr (quals, parmY)) else if (wcsstr (quals, parmY))
force = TRUE; force = TRUE;
else { else {
static const WCHAR copyCmdW[] = {'C','O','P','Y','C','M','D','\0'}; static const WCHAR copyCmdW[] = {'C','O','P','Y','C','M','D','\0'};
/* By default, we will force the overwrite in batch mode and ask for
* confirmation in interactive mode. */
force = !interactive;
/* If COPYCMD is set, then we force the overwrite with /Y and ask for
* confirmation with /-Y. If COPYCMD is neither of those, then we use the
* default behavior. */
len = GetEnvironmentVariableW(copyCmdW, copycmd, ARRAY_SIZE(copycmd)); len = GetEnvironmentVariableW(copyCmdW, copycmd, ARRAY_SIZE(copycmd));
force = (len && len < ARRAY_SIZE(copycmd) && !lstrcmpiW(copycmd, parmY)); if (len && len < ARRAY_SIZE(copycmd)) {
if (!lstrcmpiW (copycmd, parmY))
force = TRUE;
else if (!lstrcmpiW (copycmd, parmNoY))
force = FALSE;
}
} }
/* Prompt if overwriting */ /* Prompt if overwriting */
......
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