ShellPkg: Fix for the ‘mv’ command when destination starts with ‘\’.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chris Phillips <chrisp@hp.com>
reviewed-by: Jaben Carsey <jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14787 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Chris Phillips 2013-10-18 20:10:18 +00:00 committed by jcarsey
parent 58b7301ec9
commit c32ad35161
1 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,7 @@
/** @file /** @file
Main file for mv shell level 2 function. Main file for mv shell level 2 function.
Copyright (c) 2013, Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -137,6 +138,7 @@ GetDestinationLocation(
EFI_SHELL_FILE_INFO *Node; EFI_SHELL_FILE_INFO *Node;
CHAR16 *DestPath; CHAR16 *DestPath;
UINTN NewSize; UINTN NewSize;
UINTN CurrentSize;
DestList = NULL; DestList = NULL;
DestPath = NULL; DestPath = NULL;
@ -151,6 +153,13 @@ GetDestinationLocation(
} }
StrCpy(DestPath, Cwd); StrCpy(DestPath, Cwd);
while (PathRemoveLastItem(DestPath)) ; while (PathRemoveLastItem(DestPath)) ;
//
// Append DestDir beyond '\' which may be present
//
CurrentSize = StrSize(DestPath);
StrnCatGrow(&DestPath, &CurrentSize, &DestDir[1], 0);
*DestPathPointer = DestPath; *DestPathPointer = DestPath;
return (SHELL_SUCCESS); return (SHELL_SUCCESS);
} }