mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-14 08:36:07 +00:00
cmd: Set success/failure return code for MOVE command.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
ca3b24733a
commit
90d278f932
|
@ -1928,11 +1928,10 @@ void WCMD_popd (void) {
|
||||||
* Move a file, directory tree or wildcarded set of files.
|
* Move a file, directory tree or wildcarded set of files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void WCMD_move (void)
|
RETURN_CODE WCMD_move(void)
|
||||||
{
|
{
|
||||||
BOOL status;
|
|
||||||
WIN32_FIND_DATAW fd;
|
WIN32_FIND_DATAW fd;
|
||||||
HANDLE hff;
|
HANDLE hff;
|
||||||
WCHAR input[MAX_PATH];
|
WCHAR input[MAX_PATH];
|
||||||
WCHAR output[MAX_PATH];
|
WCHAR output[MAX_PATH];
|
||||||
WCHAR drive[10];
|
WCHAR drive[10];
|
||||||
|
@ -1942,7 +1941,7 @@ void WCMD_move (void)
|
||||||
|
|
||||||
if (param1[0] == 0x00) {
|
if (param1[0] == 0x00) {
|
||||||
WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOARG));
|
WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOARG));
|
||||||
return;
|
return errorlevel = ERROR_INVALID_FUNCTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If no destination supplied, assume current directory */
|
/* If no destination supplied, assume current directory */
|
||||||
|
@ -1953,7 +1952,8 @@ void WCMD_move (void)
|
||||||
/* If 2nd parm is directory, then use original filename */
|
/* If 2nd parm is directory, then use original filename */
|
||||||
/* Convert partial path to full path */
|
/* Convert partial path to full path */
|
||||||
if (!WCMD_get_fullpath(param1, ARRAY_SIZE(input), input, NULL) ||
|
if (!WCMD_get_fullpath(param1, ARRAY_SIZE(input), input, NULL) ||
|
||||||
!WCMD_get_fullpath(param2, ARRAY_SIZE(output), output, NULL)) return;
|
!WCMD_get_fullpath(param2, ARRAY_SIZE(output), output, NULL))
|
||||||
|
return errorlevel = ERROR_INVALID_FUNCTION;
|
||||||
WINE_TRACE("Move from '%s'('%s') to '%s'\n", wine_dbgstr_w(input),
|
WINE_TRACE("Move from '%s'('%s') to '%s'\n", wine_dbgstr_w(input),
|
||||||
wine_dbgstr_w(param1), wine_dbgstr_w(output));
|
wine_dbgstr_w(param1), wine_dbgstr_w(output));
|
||||||
|
|
||||||
|
@ -1962,8 +1962,9 @@ void WCMD_move (void)
|
||||||
|
|
||||||
hff = FindFirstFileW(input, &fd);
|
hff = FindFirstFileW(input, &fd);
|
||||||
if (hff == INVALID_HANDLE_VALUE)
|
if (hff == INVALID_HANDLE_VALUE)
|
||||||
return;
|
return errorlevel = ERROR_INVALID_FUNCTION;
|
||||||
|
|
||||||
|
errorlevel = NO_ERROR;
|
||||||
do {
|
do {
|
||||||
WCHAR dest[MAX_PATH];
|
WCHAR dest[MAX_PATH];
|
||||||
WCHAR src[MAX_PATH];
|
WCHAR src[MAX_PATH];
|
||||||
|
@ -2036,19 +2037,15 @@ void WCMD_move (void)
|
||||||
flags |= MOVEFILE_REPLACE_EXISTING;
|
flags |= MOVEFILE_REPLACE_EXISTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok) {
|
if (!ok || !MoveFileExW(src, dest, flags))
|
||||||
status = MoveFileExW(src, dest, flags);
|
{
|
||||||
} else {
|
if (!ok) WCMD_print_error();
|
||||||
status = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!status) {
|
|
||||||
WCMD_print_error ();
|
|
||||||
errorlevel = ERROR_INVALID_FUNCTION;
|
errorlevel = ERROR_INVALID_FUNCTION;
|
||||||
}
|
}
|
||||||
} while (FindNextFileW(hff, &fd) != 0);
|
} while (FindNextFileW(hff, &fd) != 0);
|
||||||
|
|
||||||
FindClose(hff);
|
FindClose(hff);
|
||||||
|
return errorlevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
|
@ -480,11 +480,11 @@ SUCCESS 0
|
||||||
@todo_wine@FAILURE 1
|
@todo_wine@FAILURE 1
|
||||||
@todo_wine@FAILURE 1
|
@todo_wine@FAILURE 1
|
||||||
--- success/failure for MOVE command
|
--- success/failure for MOVE command
|
||||||
@todo_wine@FAILURE 1
|
FAILURE 1
|
||||||
@todo_wine@SUCCESS 0
|
SUCCESS 0
|
||||||
@todo_wine@FAILURE 1
|
FAILURE 1
|
||||||
@todo_wine@FAILURE 1
|
FAILURE 1
|
||||||
@todo_wine@FAILURE 1
|
FAILURE 1
|
||||||
--- success/failure for RENAME command
|
--- success/failure for RENAME command
|
||||||
@todo_wine@FAILURE 1
|
@todo_wine@FAILURE 1
|
||||||
@todo_wine@FAILURE 1
|
@todo_wine@FAILURE 1
|
||||||
|
|
|
@ -179,7 +179,7 @@ void WCMD_give_help (const WCHAR *args);
|
||||||
RETURN_CODE WCMD_goto(void);
|
RETURN_CODE WCMD_goto(void);
|
||||||
void WCMD_leave_paged_mode(void);
|
void WCMD_leave_paged_mode(void);
|
||||||
void WCMD_more (WCHAR *);
|
void WCMD_more (WCHAR *);
|
||||||
void WCMD_move (void);
|
RETURN_CODE WCMD_move (void);
|
||||||
WCHAR* WINAPIV WCMD_format_string (const WCHAR *format, ...);
|
WCHAR* WINAPIV WCMD_format_string (const WCHAR *format, ...);
|
||||||
void WINAPIV WCMD_output (const WCHAR *format, ...);
|
void WINAPIV WCMD_output (const WCHAR *format, ...);
|
||||||
void WINAPIV WCMD_output_stderr (const WCHAR *format, ...);
|
void WINAPIV WCMD_output_stderr (const WCHAR *format, ...);
|
||||||
|
|
|
@ -1852,7 +1852,7 @@ static RETURN_CODE execute_single_command(const WCHAR *command)
|
||||||
WCMD_create_dir (parms_start);
|
WCMD_create_dir (parms_start);
|
||||||
break;
|
break;
|
||||||
case WCMD_MOVE:
|
case WCMD_MOVE:
|
||||||
WCMD_move ();
|
return_code = WCMD_move();
|
||||||
break;
|
break;
|
||||||
case WCMD_PATH:
|
case WCMD_PATH:
|
||||||
WCMD_setshow_path (parms_start);
|
WCMD_setshow_path (parms_start);
|
||||||
|
|
Loading…
Reference in a new issue