summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2015-10-27 03:29:50 +0000
committeryzhu52 <yzhu52@Edk2>2015-10-27 03:29:50 +0000
commit7919244076ebb8726ef5fe91aecc00726c706da2 (patch)
treecfe3bfbac57df9c1de1804a682b64ddedfa6808f
parent7254d134706361032d3b87bfecb96d15c1d43401 (diff)
downloadedk2-7919244076ebb8726ef5fe91aecc00726c706da2.tar.gz
edk2-7919244076ebb8726ef5fe91aecc00726c706da2.tar.bz2
edk2-7919244076ebb8726ef5fe91aecc00726c706da2.zip
BaseTools:remove the redundant directories for '-f' with absolute path.
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
-rw-r--r--BaseTools/Source/C/Split/Split.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/BaseTools/Source/C/Split/Split.c b/BaseTools/Source/C/Split/Split.c
index b63aef78f9..44a09681d3 100644
--- a/BaseTools/Source/C/Split/Split.c
+++ b/BaseTools/Source/C/Split/Split.c
@@ -2,7 +2,7 @@
Split a file into two pieces at the request offset.
-Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
@@ -58,7 +58,7 @@ Returns:
--*/
{
printf ("%s Version %d.%d %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
- printf ("Copyright (c) 1999-2014 Intel Corporation. All rights reserved.\n");
+ printf ("Copyright (c) 1999-2015 Intel Corporation. All rights reserved.\n");
printf ("\n SplitFile creates two Binary files either in the same directory as the current working\n");
printf (" directory or in the specified directory.\n");
}
@@ -176,20 +176,25 @@ CreateDir (
{
CHAR8* temp = *FullFileName;
CHAR8* start = temp;
+ CHAR8 tempchar;
UINT64 index = 0;
for (;index < strlen(temp); ++index) {
if (temp[index] == '\\' || temp[index] == '/') {
- temp[index] = 0;
- if (chdir(start)) {
- if (mkdir(start, S_IRWXU | S_IRWXG | S_IRWXO) != 0) {
- return EFI_ABORTED;
+ if (temp[index + 1] != '\0') {
+ tempchar = temp[index + 1];
+ temp[index + 1] = 0;
+ if (chdir(start)) {
+ if (mkdir(start, S_IRWXU | S_IRWXG | S_IRWXO) != 0) {
+ return EFI_ABORTED;
+ }
+ chdir(start);
}
- chdir(start);
+ start = temp + index + 1;
+ temp[index] = '/';
+ temp[index + 1] = tempchar;
+ }
}
- start = temp + index + 1;
- temp[index] = '/';
- }
}
return EFI_SUCCESS;