X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FUPT%2FLibrary%2FString.py;h=278073e4a379786ba26c5f1b832bec32f1fb7049;hp=89371dbdbf562e70a3471c3fbf36a7a6a437ae50;hb=f71b163020d7f97e0533c412d175bc642f628ef6;hpb=cefbbb3d087143316fba077dd02964afb92f647f 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'))