Better way to fix 868. Check the last error instead of checking before hand. Thanks to billgMS for point this out.

svn path=/trunk/; revision=18267
This commit is contained in:
Brandon Turner 2005-10-04 15:32:04 +00:00
parent 4d9e3c92a6
commit 4dbeaea6e7
3 changed files with 18 additions and 9 deletions

View file

@ -571,7 +571,8 @@ STRING_CHCP_ERROR4, "Invalid code page\n"
STRING_CHOICE_ERROR, "Invalid option. Expected format: /C[:]options"
STRING_CHOICE_ERROR_TXT, "Invalid option. Expected format: /T[:]c,nn"
STRING_CHOICE_ERROR_OPTION, "Illegal Option: %s"
STRING_MD_ERROR, "A subdirectory or file ass already exists.\n"
STRING_MD_ERROR, "A subdirectory or file already exists.\n"
STRING_MD_ERROR2, "The path to the new folder does not exist.\n"
STRING_CMD_ERROR1, "Can't redirect input from file %s\n"
STRING_CMD_ERROR2, "Error creating temporary file for pipe data\n"
STRING_CMD_ERROR3, "Can't redirect to file %s\n"

View file

@ -472,6 +472,9 @@ INT cmd_mkdir (LPTSTR cmd, LPTSTR param)
if (!dir)
{
ConErrResPuts (STRING_ERROR_REQ_PARAM_MISSING);
nErrorLevel = 1;
if(p != NULL)
freep (p);
return 1;
}
@ -479,16 +482,20 @@ INT cmd_mkdir (LPTSTR cmd, LPTSTR param)
if (_tcslen (dir) >= 2 && dir[_tcslen (dir) - 1] == _T('\\'))
dir[_tcslen(dir) - 1] = _T('\0');
if(IsExistingDirectory(dir) || IsExistingFile(dir))
{
ConErrResPuts(STRING_MD_ERROR);
freep(p);
nErrorLevel = 1;
return 1;
}
if (!CreateDirectory (dir, NULL))
{
ErrorMessage (GetLastError(), _T("MD"));
if(GetLastError() == ERROR_ALREADY_EXISTS)
{
ConErrResPuts(STRING_MD_ERROR);
}
else if(GetLastError() == ERROR_PATH_NOT_FOUND)
{
ConErrResPuts(STRING_MD_ERROR2);
}
else
{
ErrorMessage (GetLastError(), _T("MD"));
}
nErrorLevel = 1;
freep (p);
return 1;

View file

@ -221,6 +221,7 @@
#define STRING_SYNTAX_COMMAND_INCORRECT 723
#define STRING_RMDIR_HELP2 724
#define STRING_MD_ERROR 725
#define STRING_MD_ERROR2 726
/* These strings are language independent (cmd.rc) */