From ab94587a7d2cd89695f9190420daceae0d2b7446 Mon Sep 17 00:00:00 2001 From: jcarsey Date: Thu, 30 Jun 2011 22:58:53 +0000 Subject: This refactors 3 functions out of ShellCommandLib and puts them into a new library (but as 2 functions instead of 3). This allows for users outside of the shell itself to have access to these functions. 1) Remove the 3 functions out of the shell's internal library (ShellCommandLib) 2) Add a new library class (PathLib) 3) Add an instance of this class (BasePathLib) 4) Change all internal shell callers to use this new library class. signed-off-by: jcarsey reviewed-by: jljusten git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11936 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Application/Shell/FileHandleWrappers.c | 2 +- ShellPkg/Application/Shell/Shell.c | 2 +- ShellPkg/Application/Shell/Shell.h | 1 + ShellPkg/Application/Shell/Shell.inf | 3 ++- ShellPkg/Application/Shell/ShellProtocol.c | 12 ++++++------ 5 files changed, 11 insertions(+), 9 deletions(-) (limited to 'ShellPkg/Application/Shell') diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c b/ShellPkg/Application/Shell/FileHandleWrappers.c index 3cadc41e0b..22e8c71d12 100644 --- a/ShellPkg/Application/Shell/FileHandleWrappers.c +++ b/ShellPkg/Application/Shell/FileHandleWrappers.c @@ -522,7 +522,7 @@ FileInterfaceStdInRead( } StrCat(TabStr, L"*"); FoundFileList = NULL; -// TabStr = CleanPath(TabStr); +// TabStr = PathCleanUpDirectories(TabStr); Status = ShellInfoObject.NewEfiShellProtocol->FindFiles(TabStr, &FoundFileList); for ( TempStr = CurrentString ; *TempStr == L' ' diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index ae4c0606e3..452c65588b 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -859,7 +859,7 @@ DoStartupScript( *TempSpot = CHAR_NULL; } FileStringPath = StrnCatGrow(&FileStringPath, &NewSize, ((FILEPATH_DEVICE_PATH*)FilePath)->PathName, 0); - ChopLastSlash(FileStringPath); + PathRemoveLastItem(FileStringPath); FileStringPath = StrnCatGrow(&FileStringPath, &NewSize, mStartupScript, 0); Status = ShellInfoObject.NewEfiShellProtocol->OpenFileByName(FileStringPath, &FileHandle, EFI_FILE_MODE_READ); FreePool(FileStringPath); diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h index 51ec4f3a4b..e79c5481f3 100644 --- a/ShellPkg/Application/Shell/Shell.h +++ b/ShellPkg/Application/Shell/Shell.h @@ -44,6 +44,7 @@ #include #include #include +#include #include "ShellParametersProtocol.h" #include "ShellProtocol.h" diff --git a/ShellPkg/Application/Shell/Shell.inf b/ShellPkg/Application/Shell/Shell.inf index f873fdaf6c..756e84137e 100644 --- a/ShellPkg/Application/Shell/Shell.inf +++ b/ShellPkg/Application/Shell/Shell.inf @@ -1,7 +1,7 @@ ## @file # This is the shell application # -# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -69,6 +69,7 @@ HiiLib SortLib HandleParsingLib + PathLib [Guids] gShellVariableGuid # ALWAYS_CONSUMED diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index f0416ca937..e42f081834 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -529,7 +529,7 @@ EfiShellGetDevicePathFromFilePath( StrCpy(NewPath, Cwd); if (*Path == L'\\') { Path++; - while (ChopLastSlash(NewPath)) ; + while (PathRemoveLastItem(NewPath)) ; } StrCat(NewPath, Path); DevicePathForReturn = EfiShellGetDevicePathFromFilePath(NewPath); @@ -2232,7 +2232,7 @@ EfiShellFindFiles( } StrCpy(PatternCopy, FilePattern); - PatternCopy = CleanPath(PatternCopy); + PatternCopy = PathCleanUpDirectories(PatternCopy); Count = StrStr(PatternCopy, L":") - PatternCopy; Count += 2; @@ -2293,7 +2293,7 @@ EfiShellOpenFileList( CONST CHAR16 *CurDir; BOOLEAN Found; - ShellCommandCleanPath(Path); + PathCleanUpDirectories(Path); Path2Size = 0; Path2 = NULL; @@ -2315,7 +2315,7 @@ EfiShellOpenFileList( StrnCatGrow(&Path2, &Path2Size, CurDir, 0); if (*Path == L'\\') { Path++; - while (ChopLastSlash(Path2)) ; + while (PathRemoveLastItem(Path2)) ; } ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL)); StrnCatGrow(&Path2, &Path2Size, Path, 0); @@ -2324,7 +2324,7 @@ EfiShellOpenFileList( StrnCatGrow(&Path2, NULL, Path, 0); } - CleanPath (Path2); + PathCleanUpDirectories (Path2); // // do the search @@ -2677,7 +2677,7 @@ EfiShellSetCurDir( DirectoryName = StrnCatGrow(&DirectoryName, NULL, Dir, 0); ASSERT(DirectoryName != NULL); - CleanPath(DirectoryName); + PathCleanUpDirectories(DirectoryName); if (FileSystem == NULL) { // -- cgit v1.2.3