On 10/4/2018 12:02 AM, jim.dai...@dell.com wrote:
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 <jim_dai...@dell.com>
---
  ShellPkg/Application/Shell/Shell.c | 2 ++
  1 file changed, 2 insertions(+)

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);

Jim,
Creating spec-undefined "homefilesystem" ENV variable is not a good idea in my opinion. Can you submit a Shell Spec change and change the implementation once the spec change is approved?

--
Thanks,
Ray
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to