summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel2CommandsLib
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/Library/UefiShellLevel2CommandsLib
parentf1518f69703e1086f346a6e9d8e5a59855954178 (diff)
downloadedk2-ab94587a7d2cd89695f9190420daceae0d2b7446.zip
edk2-ab94587a7d2cd89695f9190420daceae0d2b7446.tar.gz
edk2-ab94587a7d2cd89695f9190420daceae0d2b7446.tar.bz2
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/Library/UefiShellLevel2CommandsLib')
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c6
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c4
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c2
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c4
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c2
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h1
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf1
7 files changed, 11 insertions, 9 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
index bee4b0a..82d1c39 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
@@ -108,7 +108,7 @@ ShellCommandRunCd (
ShellStatus = SHELL_NOT_FOUND;
} else {
Drive = GetFullyQualifiedPath(Directory);
- ChopLastSlash(Drive);
+ PathRemoveLastItem(Drive);
}
if (ShellStatus == SHELL_SUCCESS && Drive != NULL) {
//
@@ -130,7 +130,7 @@ ShellCommandRunCd (
ShellStatus = SHELL_NOT_FOUND;
} else {
Drive = GetFullyQualifiedPath(Directory);
- while (ChopLastSlash(Drive)) ;
+ while (PathRemoveLastItem(Drive)) ;
}
if (ShellStatus == SHELL_SUCCESS && Drive != NULL) {
//
@@ -150,7 +150,7 @@ ShellCommandRunCd (
ASSERT((Drive == NULL && DriveSize == 0) || (Drive != NULL));
Drive = StrnCatGrow(&Drive, &DriveSize, ShellGetCurrentDir(NULL), 0);
if (*Param1 == L'\\') {
- while (ChopLastSlash(Drive)) ;
+ while (PathRemoveLastItem(Drive)) ;
Drive = StrnCatGrow(&Drive, &DriveSize, Param1+1, 0);
} else {
Drive = StrnCatGrow(&Drive, &DriveSize, Param1, 0);
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
index 8b30ac3..08f5514 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
@@ -416,7 +416,7 @@ ValidateAndCopyFiles(
break;
}
- CleanPath(DestPath);
+ PathCleanUpDirectories(DestPath);
ShellPrintEx(-1, -1, HiiOutput, Node->FullName, DestPath);
@@ -619,7 +619,7 @@ ShellCommandRunCp (
// now copy them all...
//
if (FileList != NULL && !IsListEmpty(&FileList->Link)) {
- ShellStatus = ProcessValidateAndCopyFiles(FileList, ShellCommandCleanPath((CHAR16*)ShellCommandLineGetRawValue(Package, ParamCount)), SilentMode, RecursiveMode);
+ ShellStatus = ProcessValidateAndCopyFiles(FileList, PathCleanUpDirectories((CHAR16*)ShellCommandLineGetRawValue(Package, ParamCount)), SilentMode, RecursiveMode);
Status = ShellCloseFileMetaArg(&FileList);
if (EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_FILE), gShellLevel2HiiHandle, ShellCommandLineGetRawValue(Package, ParamCount), ShellStatus|MAX_BIT);
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
index ac71350..a93b54c 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
@@ -67,7 +67,7 @@ PrintLsOutput(
CorrectedPath = StrnCatGrow(&CorrectedPath, NULL, Path, 0);
ASSERT(CorrectedPath != NULL);
- ShellCommandCleanPath(CorrectedPath);
+ PathCleanUpDirectories(CorrectedPath);
Status = ShellOpenFileMetaArg((CHAR16*)CorrectedPath, EFI_FILE_MODE_READ, &ListHead);
if (EFI_ERROR(Status)) {
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
index dc9ef64..5afcea2 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
@@ -148,7 +148,7 @@ GetDestinationLocation(
return (SHELL_OUT_OF_RESOURCES);
}
StrCpy(DestPath, Cwd);
- while (ChopLastSlash(DestPath)) ;
+ while (PathRemoveLastItem(DestPath)) ;
*DestPathPointer = DestPath;
return (SHELL_SUCCESS);
}
@@ -268,7 +268,7 @@ ValidateAndMoveFiles(
if (ShellStatus != SHELL_SUCCESS) {
return (ShellStatus);
}
- DestPath = CleanPath(DestPath);
+ DestPath = PathCleanUpDirectories(DestPath);
HiiOutput = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_MV_OUTPUT), NULL);
HiiResultOk = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_GEN_RES_OK), NULL);
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c
index fed233c..ce3d87b 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c
@@ -196,7 +196,7 @@ GetFullyQualifiedPath(
}
StrnCatGrow(&PathToReturn, &Size, Path, 0);
- CleanPath(PathToReturn);
+ PathCleanUpDirectories(PathToReturn);
while (PathToReturn[StrLen(PathToReturn)-1] == L'*') {
PathToReturn[StrLen(PathToReturn)-1] = CHAR_NULL;
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h
index 49e187f..80f6d59 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h
@@ -46,6 +46,7 @@
#include <Library/HiiLib.h>
#include <Library/SortLib.h>
#include <Library/FileHandleLib.h>
+#include <Library/PathLib.h>
extern CONST CHAR16 mFileName[];
extern EFI_HANDLE gShellLevel2HiiHandle;
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
index 8b618b1..52dc28f 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
@@ -64,6 +64,7 @@
PcdLib
HiiLib
HandleParsingLib
+ PathLib
[Protocols]
gEfiUnicodeCollation2ProtocolGuid # ALWAYS_CONSUMED