]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Library/String.py
BaseTools/UPT: Fix UNI file name issue
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Library / String.py
index 89371dbdbf562e70a3471c3fbf36a7a6a437ae50..278073e4a379786ba26c5f1b832bec32f1fb7049 100644 (file)
@@ -969,6 +969,7 @@ def GetUniFileName(FilePath, FileName):
         pass\r
 \r
     LargestIndex = -1\r
+    IndexNotFound = True\r
     for File in Files:\r
         if File.upper().startswith(FileName.upper()) and File.upper().endswith('.UNI'):\r
             Index = File.upper().replace(FileName.upper(), '').replace('.UNI', '')\r
@@ -978,11 +979,12 @@ def GetUniFileName(FilePath, FileName):
                 except Exception:\r
                     Index = -1\r
             else:\r
+                IndexNotFound = False\r
                 Index = 0\r
             if Index > LargestIndex:\r
                 LargestIndex = Index + 1\r
 \r
-    if LargestIndex > -1:\r
+    if LargestIndex > -1 and not IndexNotFound:\r
         return os.path.normpath(os.path.join(FilePath, FileName + str(LargestIndex) + '.uni'))\r
     else:\r
         return os.path.normpath(os.path.join(FilePath, FileName + '.uni'))\r