mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 09:50:02 +00:00
Check to see if a folder or file is already there when makign a folder. Set correct errorlevel when fail to create folder. fixes bug 868.
svn path=/trunk/; revision=18266
This commit is contained in:
parent
55265598c2
commit
4d9e3c92a6
3 changed files with 11 additions and 2 deletions
|
@ -571,6 +571,7 @@ 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_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"
|
||||
|
|
|
@ -433,7 +433,7 @@ INT cmd_mkdir (LPTSTR cmd, LPTSTR param)
|
|||
LPTSTR place; /* used to search for the \ when no space is used */
|
||||
LPTSTR *p = NULL;
|
||||
INT argc;
|
||||
|
||||
nErrorLevel = 0;
|
||||
if (!_tcsncmp (param, _T("/?"), 2))
|
||||
{
|
||||
ConOutResPaging(TRUE,STRING_MKDIR_HELP);
|
||||
|
@ -479,10 +479,17 @@ 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"));
|
||||
|
||||
nErrorLevel = 1;
|
||||
freep (p);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -220,6 +220,7 @@
|
|||
#define STRING_EXPECTED_NUMBER_OR_VARIABLE 722
|
||||
#define STRING_SYNTAX_COMMAND_INCORRECT 723
|
||||
#define STRING_RMDIR_HELP2 724
|
||||
#define STRING_MD_ERROR 725
|
||||
|
||||
|
||||
/* These strings are language independent (cmd.rc) */
|
||||
|
|
Loading…
Reference in a new issue