From: Jim.Dailey@dell.com Date: Wed, 3 Oct 2018 16:02:24 +0000 (-0700) Subject: ShellPkg: Create a homefilesystem environment variable X-Git-Tag: edk2-stable201903~896 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c0b1f749ef1304810ed4ea58ded65b7f41d79d3e;hp=c526dcd40f3a0f3a091684481f9c85f03f6a70a7;p=mirror_edk2.git ShellPkg: Create a homefilesystem environment variable Create a homefilesystem environment variable whose value is the file system on which the executing shell is located. For example: "FS14:". This eliminates the need for people to have to try and find the "boot" file system in their startup script. After this change they can simply execute %homefilesystem% to set the cwd to the root of the file system where the shell is located. A future enhancement could be to add "homefilesystem" to the list of predefined, read-only variables listed in the EfiShellSetEnv function of file ShellProtocol.c Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jim Dailey Reviewed-by: Jaben Carsey --- diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index 3f3bcbb4b0..6185b6ac80 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -1169,6 +1169,8 @@ LocateStartupScript ( *TempSpot = CHAR_NULL; } + InternalEfiShellSetEnv(L"homefilesystem", StartupScriptPath, TRUE); + StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, ((FILEPATH_DEVICE_PATH *)FileDevicePath)->PathName, 0); PathRemoveLastItem (StartupScriptPath); StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, mStartupScript, 0);