[CMD] Improve the way the ErrorMessage() helper and the MKDIR and RMDIR commands report their errors.

For MKDIR, also properly support the case of ERROR_FILE_EXISTS and
ERROR_ALREADY_EXISTS last-errors by displaying the standard error
"A subdirectory or file XXX already exists.\n"
This commit is contained in:
Hermès Bélusca-Maïto 2020-07-01 02:39:25 +02:00
parent 1efbcd3d5d
commit 5830ccb85e
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 16 additions and 7 deletions

View file

@ -50,7 +50,7 @@ ErrorMessage(
NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&szError, 0, NULL))
{
ConErrPrintf(_T("%s %s\n"), szError, szMessage);
ConErrPrintf(_T("%s%s%s"), szError, szMessage, (*szMessage ? _T("\n") : _T("")));
if (szError)
LocalFree(szError);
return;