summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c')
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
index 08f5514cf5..00b51b4111 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
@@ -359,7 +359,19 @@ ValidateAndCopyFiles(
//
// we have multiple files or a directory in the DestDir
//
- if (StrStr(DestDir, L":") == NULL) {
+
+ //
+ // Check for leading slash
+ //
+ if (DestDir[0] == L'\\') {
+ //
+ // Copy to the root of CWD
+ //
+ StrCpy(DestPath, Cwd);
+ while (PathRemoveLastItem(DestPath));
+ StrCat(DestPath, DestDir+1);
+ StrCat(DestPath, Node->FileName);
+ } else if (StrStr(DestDir, L":") == NULL) {
StrCpy(DestPath, Cwd);
if (DestPath[StrLen(DestPath)-1] != L'\\' && DestDir[0] != L'\\') {
StrCat(DestPath, L"\\");