]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
ShellPkg: Fix the Non-ASCII char and do code refine.
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / Mv.c
index efea51b48a6c6aedb7ba4cd0198c7ae3ad5f5640..c025cebe5689a6303c6fa3f37e99ef3ac43e2534 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for mv shell level 2 function.\r
 \r
-  Copyright (c) 2013 - 2015, Hewlett-Packard Development Company, L.P.<BR>\r
+  (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<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
@@ -128,7 +128,7 @@ IsValidMove(
   //\r
   // If they're the same, or if source is "above" dest on file path tree\r
   //\r
-  if ( StrCmp(DestPathWalker, SourcePath) == 0 \r
+  if ( StringNoCaseCompare (&DestPathWalker, &SourcePath) == 0 \r
     || StrStr(DestPathWalker, SourcePath) == DestPathWalker \r
     ) {\r
     ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MV_INV_SUB), gShellLevel2HiiHandle);\r
@@ -291,25 +291,33 @@ MoveBetweenFileSystems(
   OUT VOID                **Resp\r
   )\r
 {\r
-  EFI_STATUS    Status;\r
+  SHELL_STATUS    ShellStatus;\r
 \r
   //\r
   // First we copy the file\r
   //\r
-  Status = CopySingleFile(Node->FullName, DestPath, Resp, TRUE);\r
+  ShellStatus = CopySingleFile (Node->FullName, DestPath, Resp, TRUE, L"mv");\r
 \r
   //\r
   // Check our result\r
   //\r
-  if (!EFI_ERROR(Status)) {\r
+  if (ShellStatus == SHELL_SUCCESS) {\r
     //\r
     // The copy was successful.  delete the source file.\r
     //\r
     CascadeDelete(Node, TRUE);\r
     Node->Handle = NULL;\r
+  } else if (ShellStatus == SHELL_ABORTED) {\r
+    return EFI_ABORTED;\r
+  } else if (ShellStatus == SHELL_ACCESS_DENIED) {\r
+    return EFI_ACCESS_DENIED;\r
+  } else if (ShellStatus == SHELL_VOLUME_FULL) {\r
+    return EFI_VOLUME_FULL;\r
+  } else {\r
+    return EFI_UNSUPPORTED;\r
   }\r
 \r
-  return (Status);\r
+  return (EFI_SUCCESS);\r
 }\r
 \r
 /**\r
@@ -587,13 +595,18 @@ ValidateAndMoveFiles(
       Status = MoveBetweenFileSystems(Node, FullDestPath!=NULL? FullDestPath:DestPath, &Response);\r
     } else {\r
       Status = MoveWithinFileSystems(Node, DestPath, &Response);\r
+      //\r
+      // Display error status\r
+      //\r
+      if (EFI_ERROR(Status)) {\r
+        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"mv", Status);\r
+      }\r
     }\r
 \r
     //\r
     // Check our result\r
     //\r
     if (EFI_ERROR(Status)) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, Status);\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
       if (Status == EFI_SECURITY_VIOLATION) {\r
         ShellStatus = SHELL_SECURITY_VIOLATION;\r