summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/UPT/Library/String.py
diff options
context:
space:
mode:
authorHess Chen <hesheng.chen@intel.com>2017-08-23 13:53:36 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2017-08-24 21:39:50 +0800
commitf71b163020d7f97e0533c412d175bc642f628ef6 (patch)
tree13cb9eab294654fe4da2b5306b2a41fea8cfd449 /BaseTools/Source/Python/UPT/Library/String.py
parentcefbbb3d087143316fba077dd02964afb92f647f (diff)
downloadedk2-f71b163020d7f97e0533c412d175bc642f628ef6.tar.gz
edk2-f71b163020d7f97e0533c412d175bc642f628ef6.tar.bz2
edk2-f71b163020d7f97e0533c412d175bc642f628ef6.zip
BaseTools/UPT: Fix UNI file name issue
Fix the issue of creating duplicate UNI file names Fix the issue of removing packages Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/UPT/Library/String.py')
-rw-r--r--BaseTools/Source/Python/UPT/Library/String.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/UPT/Library/String.py b/BaseTools/Source/Python/UPT/Library/String.py
index 89371dbdbf..278073e4a3 100644
--- a/BaseTools/Source/Python/UPT/Library/String.py
+++ b/BaseTools/Source/Python/UPT/Library/String.py
@@ -969,6 +969,7 @@ def GetUniFileName(FilePath, FileName):
pass
LargestIndex = -1
+ IndexNotFound = True
for File in Files:
if File.upper().startswith(FileName.upper()) and File.upper().endswith('.UNI'):
Index = File.upper().replace(FileName.upper(), '').replace('.UNI', '')
@@ -978,11 +979,12 @@ def GetUniFileName(FilePath, FileName):
except Exception:
Index = -1
else:
+ IndexNotFound = False
Index = 0
if Index > LargestIndex:
LargestIndex = Index + 1
- if LargestIndex > -1:
+ if LargestIndex > -1 and not IndexNotFound:
return os.path.normpath(os.path.join(FilePath, FileName + str(LargestIndex) + '.uni'))
else:
return os.path.normpath(os.path.join(FilePath, FileName + '.uni'))