@param[in] Found Set to TRUE, if anyone were found.\r
@param[in] Count The count of bits enabled in Attribs.\r
@param[in] TimeZone The current time zone offset.\r
+ @param[in] ListUnfiltered TRUE to request listing the directory contents\r
+ unfiltered.\r
\r
@retval SHELL_SUCCESS the printing was sucessful.\r
**/\r
IN CONST CHAR16 *SearchString,\r
IN BOOLEAN *Found,\r
IN CONST UINTN Count,\r
- IN CONST INT16 TimeZone\r
+ IN CONST INT16 TimeZone,\r
+ IN CONST BOOLEAN ListUnfiltered\r
)\r
{\r
EFI_STATUS Status;\r
HeaderPrinted = TRUE;\r
}\r
\r
- if (!Sfo && ShellStatus != SHELL_ABORTED) {\r
+ if (!Sfo && ShellStatus != SHELL_ABORTED && HeaderPrinted) {\r
PrintNonSfoFooter(FileCount, FileSize, DirCount);\r
}\r
}\r
SearchString,\r
&FoundOne,\r
Count,\r
- TimeZone);\r
+ TimeZone,\r
+ FALSE);\r
\r
//\r
// Since it's running recursively, we have to break immediately when returned SHELL_ABORTED\r
ShellCloseFileMetaArg(&ListHead);\r
\r
if (Found == NULL && !FoundOne) {\r
- return (SHELL_NOT_FOUND);\r
+ if (ListUnfiltered) {\r
+ //\r
+ // When running "ls" without any filtering request, avoid outputing\r
+ // "File not found" when the directory is entirely empty, but print\r
+ // header and footer stating "0 File(s), 0 Dir(s)".\r
+ //\r
+ if (!Sfo) {\r
+ PrintNonSfoHeader (RootPath);\r
+ if (ShellStatus != SHELL_ABORTED) {\r
+ PrintNonSfoFooter (FileCount, FileSize, DirCount);\r
+ }\r
+ }\r
+ } else {\r
+ return (SHELL_NOT_FOUND);\r
+ }\r
}\r
\r
if (Found != NULL) {\r
UINTN Size;\r
EFI_TIME TheTime;\r
CHAR16 *SearchString;\r
+ BOOLEAN ListUnfiltered;\r
\r
Size = 0;\r
FullPath = NULL;\r
SearchString = NULL;\r
CurDir = NULL;\r
Count = 0;\r
+ ListUnfiltered = FALSE;\r
\r
//\r
// initialize the shell lib (we must be in non-auto-init...)\r
ShellStatus = SHELL_NOT_FOUND;\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"ls");\r
}\r
+ ListUnfiltered = TRUE;\r
//\r
// Copy to the 2 strings for starting path and file search string\r
//\r
//\r
// is listing ends with a directory, then we list all files in that directory\r
//\r
+ ListUnfiltered = TRUE;\r
StrnCatGrow(&SearchString, NULL, L"*", 0);\r
} else {\r
//\r
SearchString,\r
NULL,\r
Count,\r
- TheTime.TimeZone\r
+ TheTime.TimeZone,\r
+ ListUnfiltered\r
);\r
if (ShellStatus == SHELL_NOT_FOUND) {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LS_FILE_NOT_FOUND), gShellLevel2HiiHandle, L"ls", FullPath);\r