summaryrefslogtreecommitdiffstats
path: root/ShellPkg/Application
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2016-08-05 13:10:11 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2016-08-10 10:17:05 +0800
commitdb2e266a0e926be03fb0e6c86fadf121532912d1 (patch)
tree72cc23f13bbed7e58ade2d8f714eb5df462accc3 /ShellPkg/Application
parent9fcfa150fb6047eaa0e5901c0af3e588586200e3 (diff)
downloadedk2-db2e266a0e926be03fb0e6c86fadf121532912d1.tar.gz
edk2-db2e266a0e926be03fb0e6c86fadf121532912d1.tar.bz2
edk2-db2e266a0e926be03fb0e6c86fadf121532912d1.zip
ShellPkg: TAB logic incorrectly shows files in CWD when typing \<TAB>
It should shows files in root directory of current map. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Tapan Shah <tapandshah@hpe.com>
Diffstat (limited to 'ShellPkg/Application')
-rw-r--r--ShellPkg/Application/Shell/FileHandleWrappers.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c b/ShellPkg/Application/Shell/FileHandleWrappers.c
index 00919344b5..0d38e9d5fe 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);
}
}
}