/** @file\r
Main file for cp shell level 2 function.\r
\r
- Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
if (ShellIsDirectory(Source) == EFI_SUCCESS) {\r
Status = ShellCreateDirectory(Dest, &DestHandle);\r
if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_DIR_FAIL), gShellLevel2HiiHandle, Dest);\r
return (SHELL_ACCESS_DENIED);\r
}\r
\r
//\r
Status = ShellOpenFileByName(Dest, &DestHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);\r
if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_OPEN_FAIL), gShellLevel2HiiHandle, Dest);\r
return (SHELL_ACCESS_DENIED);\r
}\r
\r
ASSERT(Buffer != NULL);\r
while (ReadSize == PcdGet32(PcdShellFileOperationSize) && !EFI_ERROR(Status)) {\r
Status = ShellReadFile(SourceHandle, &ReadSize, Buffer);\r
- Status = ShellWriteFile(DestHandle, &ReadSize, Buffer);\r
+ if (!EFI_ERROR(Status)) {\r
+ Status = ShellWriteFile(DestHandle, &ReadSize, Buffer);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_WRITE_ERROR), gShellLevel2HiiHandle, Dest);\r
+ break;\r
+ }\r
+ } else {\r
+ ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_READ_ERROR), gShellLevel2HiiHandle, Source);\r
+ break;\r
+ }\r
}\r
}\r
SHELL_FREE_NON_NULL(DestVolumeInfo);\r
}\r
-\r
+ \r
//\r
// close files\r
//\r
VOID *Response;\r
UINTN PathLen;\r
CONST CHAR16 *Cwd;\r
- CONST CHAR16 *TempLocation;\r
UINTN NewSize;\r
\r
if (Resp == NULL) {\r
break;\r
}\r
\r
- if ((TempLocation = StrniCmp(Node->FullName, DestPath, StrLen(Node->FullName))) == 0\r
+ if ((StrniCmp(Node->FullName, DestPath, StrLen(Node->FullName)) == 0)\r
&& (DestPath[StrLen(Node->FullName)] == CHAR_NULL || DestPath[StrLen(Node->FullName)] == L'\\')\r
) {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_SAME), gShellLevel2HiiHandle);\r
\r
PathCleanUpDirectories(DestPath);\r
\r
- ShellPrintEx(-1, -1, HiiOutput, Node->FullName, DestPath);\r
+ if (!SilentMode) {\r
+ ShellPrintEx(-1, -1, HiiOutput, Node->FullName, DestPath);\r
+ }\r
\r
//\r
// copy single file...\r
\r
List = NULL;\r
FullName = NULL;\r
+ FileInfo = NULL;\r
\r
ShellOpenFileMetaArg((CHAR16*)DestDir, EFI_FILE_MODE_READ, &List);\r
if (List != NULL && List->Link.ForwardLink != List->Link.BackLink) {\r
} else if (List != NULL) {\r
ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink) != NULL);\r
ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName != NULL);\r
- FileInfo = NULL;\r
FileInfo = gEfiShellProtocol->GetFileInfo(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->Handle);\r
ASSERT(FileInfo != NULL);\r
StrnCatGrow(&FullName, NULL, ((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName, 0);\r