ASSERT(FileList != NULL);\r
ASSERT(DestDir != NULL);\r
\r
- //\r
- // We already verified that this was present.\r
- //\r
- ASSERT(Cwd != NULL);\r
-\r
//\r
// If we are trying to copy multiple files... make sure we got a directory for the target...\r
//\r
\r
NewSize = StrSize(DestDir);\r
NewSize += StrSize(Node->FullName);\r
- NewSize += StrSize(Cwd);\r
+ NewSize += (Cwd == NULL)? 0 : StrSize(Cwd);\r
if (NewSize > PathLen) {\r
PathLen = NewSize;\r
}\r
//\r
// simple copy of a single file\r
//\r
- StrCpy(DestPath, Cwd);\r
+ if (Cwd != NULL) {\r
+ StrCpy(DestPath, Cwd);\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, DestDir);\r
+ return (SHELL_INVALID_PARAMETER);\r
+ }\r
if (DestPath[StrLen(DestPath)-1] != L'\\' && DestDir[0] != L'\\') {\r
StrCat(DestPath, L"\\");\r
} else if (DestPath[StrLen(DestPath)-1] == L'\\' && DestDir[0] == L'\\') {\r
// Check for leading slash\r
//\r
if (DestDir[0] == L'\\') {\r
- //\r
- // Copy to the root of CWD\r
- //\r
- StrCpy(DestPath, Cwd);\r
+ //\r
+ // Copy to the root of CWD\r
+ //\r
+ if (Cwd != NULL) {\r
+ StrCpy(DestPath, Cwd);\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, DestDir);\r
+ return (SHELL_INVALID_PARAMETER);\r
+ }\r
while (PathRemoveLastItem(DestPath));\r
StrCat(DestPath, DestDir+1);\r
StrCat(DestPath, Node->FileName);\r
} else if (StrStr(DestDir, L":") == NULL) {\r
- StrCpy(DestPath, Cwd);\r
+ if (Cwd != NULL) {\r
+ StrCpy(DestPath, Cwd);\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, DestDir);\r
+ return (SHELL_INVALID_PARAMETER);\r
+ }\r
if (DestPath[StrLen(DestPath)-1] != L'\\' && DestDir[0] != L'\\') {\r
StrCat(DestPath, L"\\");\r
} else if (DestPath[StrLen(DestPath)-1] == L'\\' && DestDir[0] == L'\\') {\r
SHELL_FREE_NON_NULL(FileInfo);\r
ShellCloseFileMetaArg(&List);\r
} else {\r
- ShellStatus = ValidateAndCopyFiles(FileList, DestDir, SilentMode, RecursiveMode, NULL);\r
+ ShellStatus = ValidateAndCopyFiles(FileList, DestDir, SilentMode, RecursiveMode, NULL);\r
}\r
\r
return (ShellStatus);\r