It should shows files in root directory of current map.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu...@intel.com>
Cc: Jaben Carsey <jaben.car...@intel.com>
---
 ShellPkg/Application/Shell/FileHandleWrappers.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c 
b/ShellPkg/Application/Shell/FileHandleWrappers.c
index 5979d65..7db541f 100644
--- a/ShellPkg/Application/Shell/FileHandleWrappers.c
+++ b/ShellPkg/Application/Shell/FileHandleWrappers.c
@@ -368,13 +368,24 @@ CreateTabCompletionList (
 
   if (StrStr (InputString + TabPos, L":") == NULL) {
     //
-    // If file path doesn't contain ":", it's a path relative to current 
directory.
+    // If file path doesn't contain ":", ...
     //
     Cwd = ShellInfoObject.NewEfiShellProtocol->GetCurDir (NULL);
     if (Cwd != NULL) {
-      StrnCpyS (TabStr, (BufferSize) / sizeof (CHAR16), Cwd, (BufferSize) / 
sizeof (CHAR16) - 1);
       if (InputString[TabPos] != L'\\') {
+        //
+        // and it doesn't begin with "\\", it's a path relative to current 
directory.
+        // TabStr = "<cwd>\\"
+        //
+        StrnCpyS (TabStr, BufferSize / sizeof (CHAR16), Cwd, (BufferSize) / 
sizeof (CHAR16) - 1);
         StrCatS (TabStr, (BufferSize) / sizeof (CHAR16), L"\\");
+      } else {
+        //
+        // and it begins with "\\", it's a path pointing to root directory of 
current map.
+        // TabStr = "fsx:"
+        //
+        Index = StrStr (Cwd, L":") - Cwd + 1;
+        StrnCpyS (TabStr, BufferSize / sizeof (CHAR16), Cwd, Index);
       }
     }
   }
-- 
2.9.0.windows.1

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

Reply via email to