Better way to fix 868. Check the last error instead of checking before
hand. Thanks to billgMS for point this out.
Modified: trunk/reactos/subsys/system/cmd/En.rc
Modified: trunk/reactos/subsys/system/cmd/internal.c
Modified: trunk/reactos/subsys/system/cmd/resource.h
_____
Modified: trunk/reactos/subsys/system/cmd/En.rc
--- trunk/reactos/subsys/system/cmd/En.rc 2005-10-04 14:56:38 UTC
(rev 18266)
+++ trunk/reactos/subsys/system/cmd/En.rc 2005-10-04 15:32:04 UTC
(rev 18267)
@@ -571,7 +571,8 @@
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"
_____
Modified: trunk/reactos/subsys/system/cmd/internal.c
--- trunk/reactos/subsys/system/cmd/internal.c 2005-10-04 14:56:38 UTC
(rev 18266)
+++ trunk/reactos/subsys/system/cmd/internal.c 2005-10-04 15:32:04 UTC
(rev 18267)
@@ -472,6 +472,9 @@
if (!dir)
{
ConErrResPuts (STRING_ERROR_REQ_PARAM_MISSING);
+ nErrorLevel = 1;
+ if(p != NULL)
+ freep (p);
return 1;
}
@@ -479,16 +482,20 @@
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;
_____
Modified: trunk/reactos/subsys/system/cmd/resource.h
--- trunk/reactos/subsys/system/cmd/resource.h 2005-10-04 14:56:38 UTC
(rev 18266)
+++ trunk/reactos/subsys/system/cmd/resource.h 2005-10-04 15:32:04 UTC
(rev 18267)
@@ -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) */
Show replies by date