Skip to content

Commit c036c7b

Browse files
committed
Improve findSimilarVer
1 parent bbbf6ca commit c036c7b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Localize.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,14 @@ def getLink(locale):
9393
return locale
9494

9595
def findSimilarVer():
96-
sVer = ''
96+
sVer = 0
9797
for item in os.listdir(mDir):
9898
subDir = os.path.join(mDir, item)
99-
if os.path.isdir(subDir) and item.isdigit() and item < version:
100-
sVer = item
101-
return sVer
99+
if item.isdigit() and os.path.isdir(subDir):
100+
int_item = int(item)
101+
if int_item > sVer and int_item < int(version):
102+
sVer = int_item
103+
return str(sVer)
102104

103105
def isset(dict, key):
104106
try:

0 commit comments

Comments
 (0)