From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ml01.01.org (Postfix) with ESMTP id 3AFFC1A1E18 for ; Mon, 8 Aug 2016 03:28:42 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 08 Aug 2016 03:28:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,489,1464678000"; d="scan'208";a="861587485" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by orsmga003.jf.intel.com with ESMTP; 08 Aug 2016 03:28:39 -0700 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Jaben Carsey Date: Mon, 8 Aug 2016 18:28:30 +0800 Message-Id: <20160808102834.129372-3-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20160808102834.129372-1-ruiyu.ni@intel.com> References: <20160808102834.129372-1-ruiyu.ni@intel.com> Subject: [PATCH 2/6] ShellPkg: TAB logic incorrectly shows files in CWD when typing \ X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2016 10:28:42 -0000 It should shows files in root directory of current map. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Jaben Carsey --- 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 = "\\" + // + 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