]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools:remove the redundant directories for '-f' with absolute path.
authorYonghong Zhu <yonghong.zhu@intel.com>
Tue, 27 Oct 2015 03:29:50 +0000 (03:29 +0000)
committeryzhu52 <yzhu52@Edk2>
Tue, 27 Oct 2015 03:29:50 +0000 (03:29 +0000)
when the absolute path is given to '-f', it would create some redundant
empty directories.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18675 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/C/Split/Split.c

index b63aef78f9a2ef5c0855aa68535a7b668830b007..44a09681d36a9ebaebe9659faa3a4e66b59fb22c 100644 (file)
@@ -2,7 +2,7 @@
 \r
   Split a file into two pieces at the request offset.\r
 \r
-Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available\r
 under the terms and conditions of the BSD License which accompanies this\r
 distribution.  The full text of the license may be found at\r
@@ -58,7 +58,7 @@ Returns:
 --*/\r
 {\r
   printf ("%s Version %d.%d %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);\r
-  printf ("Copyright (c) 1999-2014 Intel Corporation. All rights reserved.\n");\r
+  printf ("Copyright (c) 1999-2015 Intel Corporation. All rights reserved.\n");\r
   printf ("\n  SplitFile creates two Binary files either in the same directory as the current working\n");\r
   printf ("  directory or in the specified directory.\n");\r
 }\r
@@ -176,20 +176,25 @@ CreateDir (
 {\r
   CHAR8* temp = *FullFileName;\r
   CHAR8* start = temp;\r
+  CHAR8  tempchar;\r
   UINT64 index = 0;\r
 \r
   for (;index < strlen(temp); ++index) {\r
     if (temp[index] == '\\' || temp[index] == '/') {\r
-      temp[index] = 0;\r
-      if (chdir(start)) {\r
-        if (mkdir(start, S_IRWXU | S_IRWXG | S_IRWXO) != 0) {\r
-          return EFI_ABORTED;\r
+      if (temp[index + 1] != '\0') {\r
+        tempchar = temp[index + 1];\r
+        temp[index + 1] = 0;\r
+        if (chdir(start)) {\r
+          if (mkdir(start, S_IRWXU | S_IRWXG | S_IRWXO) != 0) {\r
+            return EFI_ABORTED;\r
+          }\r
+          chdir(start);\r
         }\r
-        chdir(start);\r
+        start = temp + index + 1;\r
+        temp[index] = '/';\r
+        temp[index + 1] = tempchar;\r
+      }\r
     }\r
-      start = temp + index + 1;\r
-      temp[index] = '/';\r
-  }\r
   }\r
 \r
   return EFI_SUCCESS;\r