mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-18 09:16:17 +00:00
cmd: Set success/failure return code for RENAME command.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
90d278f932
commit
e65bcb688a
|
@ -2144,9 +2144,8 @@ void WCMD_remove_dir (WCHAR *args) {
|
||||||
* Rename a file.
|
* Rename a file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void WCMD_rename (void)
|
RETURN_CODE WCMD_rename(void)
|
||||||
{
|
{
|
||||||
BOOL status;
|
|
||||||
HANDLE hff;
|
HANDLE hff;
|
||||||
WIN32_FIND_DATAW fd;
|
WIN32_FIND_DATAW fd;
|
||||||
WCHAR input[MAX_PATH];
|
WCHAR input[MAX_PATH];
|
||||||
|
@ -2161,20 +2160,18 @@ void WCMD_rename (void)
|
||||||
/* Must be at least two args */
|
/* Must be at least two args */
|
||||||
if (param1[0] == 0x00 || param2[0] == 0x00) {
|
if (param1[0] == 0x00 || param2[0] == 0x00) {
|
||||||
WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOARG));
|
WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOARG));
|
||||||
errorlevel = ERROR_INVALID_FUNCTION;
|
return errorlevel = ERROR_INVALID_FUNCTION;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destination cannot contain a drive letter or directory separator */
|
/* Destination cannot contain a drive letter or directory separator */
|
||||||
if ((wcschr(param2,':') != NULL) || (wcschr(param2,'\\') != NULL)) {
|
if ((wcschr(param2,':') != NULL) || (wcschr(param2,'\\') != NULL)) {
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
WCMD_print_error();
|
WCMD_print_error();
|
||||||
errorlevel = ERROR_INVALID_FUNCTION;
|
return errorlevel = ERROR_INVALID_FUNCTION;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert partial path to full path */
|
/* Convert partial path to full path */
|
||||||
if (!WCMD_get_fullpath(param1, ARRAY_SIZE(input), input, NULL)) return;
|
if (!WCMD_get_fullpath(param1, ARRAY_SIZE(input), input, NULL)) return errorlevel = ERROR_INVALID_FUNCTION;
|
||||||
WINE_TRACE("Rename from '%s'('%s') to '%s'\n", wine_dbgstr_w(input),
|
WINE_TRACE("Rename from '%s'('%s') to '%s'\n", wine_dbgstr_w(input),
|
||||||
wine_dbgstr_w(param1), wine_dbgstr_w(param2));
|
wine_dbgstr_w(param1), wine_dbgstr_w(param2));
|
||||||
dotDst = wcschr(param2, '.');
|
dotDst = wcschr(param2, '.');
|
||||||
|
@ -2184,8 +2181,9 @@ void WCMD_rename (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];
|
||||||
|
@ -2228,15 +2226,14 @@ void WCMD_rename (void)
|
||||||
WINE_TRACE("Source '%s'\n", wine_dbgstr_w(src));
|
WINE_TRACE("Source '%s'\n", wine_dbgstr_w(src));
|
||||||
WINE_TRACE("Dest '%s'\n", wine_dbgstr_w(dest));
|
WINE_TRACE("Dest '%s'\n", wine_dbgstr_w(dest));
|
||||||
|
|
||||||
status = MoveFileW(src, dest);
|
if (!MoveFileW(src, dest)) {
|
||||||
|
|
||||||
if (!status) {
|
|
||||||
WCMD_print_error ();
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
|
@ -486,10 +486,10 @@ FAILURE 1
|
||||||
FAILURE 1
|
FAILURE 1
|
||||||
FAILURE 1
|
FAILURE 1
|
||||||
--- success/failure for RENAME command
|
--- success/failure for RENAME command
|
||||||
@todo_wine@FAILURE 1
|
FAILURE 1
|
||||||
@todo_wine@FAILURE 1
|
FAILURE 1
|
||||||
@todo_wine@FAILURE 1
|
FAILURE 1
|
||||||
@todo_wine@FAILURE 1
|
FAILURE 1
|
||||||
SUCCESS 0
|
SUCCESS 0
|
||||||
--- success/failure for ERASE command
|
--- success/failure for ERASE command
|
||||||
FAILURE 1
|
FAILURE 1
|
||||||
|
|
|
@ -190,7 +190,7 @@ void WCMD_popd (void);
|
||||||
void WCMD_print_error (void);
|
void WCMD_print_error (void);
|
||||||
void WCMD_pushd (const WCHAR *args);
|
void WCMD_pushd (const WCHAR *args);
|
||||||
void WCMD_remove_dir (WCHAR *command);
|
void WCMD_remove_dir (WCHAR *command);
|
||||||
void WCMD_rename (void);
|
RETURN_CODE WCMD_rename(void);
|
||||||
void WCMD_run_program (WCHAR *command, BOOL called);
|
void WCMD_run_program (WCHAR *command, BOOL called);
|
||||||
void WCMD_setlocal (const WCHAR *args);
|
void WCMD_setlocal (const WCHAR *args);
|
||||||
void WCMD_setshow_date (void);
|
void WCMD_setshow_date (void);
|
||||||
|
|
|
@ -1867,7 +1867,7 @@ static RETURN_CODE execute_single_command(const WCHAR *command)
|
||||||
break;
|
break;
|
||||||
case WCMD_REN:
|
case WCMD_REN:
|
||||||
case WCMD_RENAME:
|
case WCMD_RENAME:
|
||||||
WCMD_rename ();
|
return_code = WCMD_rename();
|
||||||
break;
|
break;
|
||||||
case WCMD_RD:
|
case WCMD_RD:
|
||||||
case WCMD_RMDIR:
|
case WCMD_RMDIR:
|
||||||
|
|
Loading…
Reference in a new issue