summaryrefslogtreecommitdiff
path: root/ShellPkg/Application
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-30 22:58:53 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-30 22:58:53 +0000
commitab94587a7d2cd89695f9190420daceae0d2b7446 (patch)
treed736759dc8ce225a8c7d1aa699703e6ca37a4a7e /ShellPkg/Application
parentf1518f69703e1086f346a6e9d8e5a59855954178 (diff)
downloadedk2-platforms-ab94587a7d2cd89695f9190420daceae0d2b7446.tar.xz
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
Diffstat (limited to 'ShellPkg/Application')
-rw-r--r--ShellPkg/Application/Shell/FileHandleWrappers.c2
-rw-r--r--ShellPkg/Application/Shell/Shell.c2
-rw-r--r--ShellPkg/Application/Shell/Shell.h1
-rw-r--r--ShellPkg/Application/Shell/Shell.inf3
-rw-r--r--ShellPkg/Application/Shell/ShellProtocol.c12
5 files changed, 11 insertions, 9 deletions
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 <Library/HiiLib.h>
#include <Library/PrintLib.h>
#include <Library/HandleParsingLib.h>
+#include <Library/PathLib.h>
#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.<BR>
+# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
#
# 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) {
//