Display 'Drive not ready' error if the user tries to list the directory on an empty drive.

svn path=/trunk/; revision=6357
This commit is contained in:
Eric Kohl 2003-10-18 17:59:29 +00:00
parent ed9a0cb22a
commit 1de8f5d574
2 changed files with 22 additions and 8 deletions

View file

@ -1,4 +1,4 @@
/* $Id: dir.c,v 1.3 2003/08/07 09:27:42 hbirr Exp $
/* $Id: dir.c,v 1.4 2003/10/18 17:59:29 ekohl Exp $
*
* DIR.C - dir internal command.
*
@ -381,7 +381,11 @@ DirParsePathspec (LPTSTR szPathspec, LPTSTR szPath, LPTSTR szFilespec)
szRootPath[0] = szPathspec[0];
start = szPathspec + 2;
SetCurrentDirectory (szRootPath);
if (!SetCurrentDirectory (szRootPath))
{
ErrorMessage (GetLastError(), NULL);
return 1;
}
}
else
{

View file

@ -51,9 +51,12 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
if (dwErrorCode == ERROR_SUCCESS)
return;
va_start (arg_ptr, szFormat);
_vstprintf (szMessage, szFormat, arg_ptr);
va_end (arg_ptr);
if (szFormat)
{
va_start (arg_ptr, szFormat);
_vstprintf (szMessage, szFormat, arg_ptr);
va_end (arg_ptr);
}
#ifndef __REACTOS__
@ -76,11 +79,15 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
switch (dwErrorCode)
{
case ERROR_FILE_NOT_FOUND:
szError = _T("File not found --");
szError = _T("File not found");
break;
case ERROR_PATH_NOT_FOUND:
szError = _T("Path not found --");
szError = _T("Path not found");
break;
case ERROR_NOT_READY:
szError = _T("Drive not ready");
break;
default:
@ -88,7 +95,10 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
return;
}
ConErrPrintf (_T("%s %s\n"), szError, szMessage);
if (szFormat)
ConErrPrintf (_T("%s -- %s\n"), szError, szMessage);
else
ConErrPrintf (_T("%s\n"), szError);
#endif
}