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>
This commit is contained in:
@ -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'))
|
||||
|
Reference in New Issue
Block a user