mirror of https://github.com/acidanthera/audk.git
ShellPkg: Refactor change to current file system
This moves the initialization for handling file system changes into a separate function. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14983 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
680db51153
commit
daf705847f
|
@ -1618,6 +1618,43 @@ ProcessNewSplitCommandLine(
|
||||||
}
|
}
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Handle a request to change the current file system
|
||||||
|
|
||||||
|
@param[in] CmdLine The passed in command line
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The operation was successful
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ChangeMappedDrive(
|
||||||
|
IN CONST CHAR16 *CmdLine
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
|
//
|
||||||
|
// make sure we are the right operation
|
||||||
|
//
|
||||||
|
ASSERT(CmdLine[(StrLen(CmdLine)-1)] == L':' && StrStr(CmdLine, L" ") == NULL);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Call the protocol API to do the work
|
||||||
|
//
|
||||||
|
Status = ShellInfoObject.NewEfiShellProtocol->SetCurDir(NULL, CmdLine);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Report any errors
|
||||||
|
//
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_MAPPING), ShellInfoObject.HiiHandle, CmdLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (Status);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Function will process and run a command line.
|
Function will process and run a command line.
|
||||||
|
|
||||||
|
@ -1702,19 +1739,16 @@ RunCommand(
|
||||||
if (ContainsSplit(CleanOriginal)) {
|
if (ContainsSplit(CleanOriginal)) {
|
||||||
Status = ProcessNewSplitCommandLine(CleanOriginal);
|
Status = ProcessNewSplitCommandLine(CleanOriginal);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If this is a mapped drive change handle that...
|
// If this is a mapped drive change handle that...
|
||||||
//
|
//
|
||||||
if (CleanOriginal[(StrLen(CleanOriginal)-1)] == L':' && StrStr(CleanOriginal, L" ") == NULL) {
|
if (CleanOriginal[(StrLen(CleanOriginal)-1)] == L':' && StrStr(CleanOriginal, L" ") == NULL) {
|
||||||
Status = ShellInfoObject.NewEfiShellProtocol->SetCurDir(NULL, CleanOriginal);
|
Status = ChangeMappedDrive(CleanOriginal);
|
||||||
if (EFI_ERROR(Status)) {
|
SHELL_FREE_NON_NULL(CleanOriginal);
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_MAPPING), ShellInfoObject.HiiHandle, CleanOriginal);
|
|
||||||
}
|
|
||||||
FreePool(CleanOriginal);
|
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///@todo update this section to divide into 3 ways - run internal command, run split (above), and run an external file...
|
///@todo update this section to divide into 3 ways - run internal command, run split (above), and run an external file...
|
||||||
/// We waste a lot of time doing processing like StdIn,StdOut,Argv,Argc for things that are external files...
|
/// We waste a lot of time doing processing like StdIn,StdOut,Argv,Argc for things that are external files...
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue