Skip to content

Commit

Permalink
Further work for previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
R-YaTian committed Dec 30, 2024
1 parent 474a1e8 commit eae17cd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions TWLMagician.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

# Check Update
def get_version():
if path.isfile('version.bin'):
remove('version.bin')
if loc == 'zh_cn' or (loca == 'zh_hans' and region == 'cn'):
version_url = 'https://gitee.com/ryatian/mirrors/raw/master/'
else:
Expand All @@ -48,10 +50,13 @@ def get_version():
with urlopen(version_url + 'version.bin') as src0, open('version.bin', 'wb') as dst0:
copyfileobj(src0, dst0, show_progress=False)
with open('version.bin', 'rb') as ftmp:
version_str = ftmp.read()
data = ftmp.read()
number = unpack_from('<I', data, offset=0)[0]
remove('version.bin')
return int(version_str)
return number
except:
if path.isfile('version.bin'):
remove('version.bin')
return -1


Expand Down

0 comments on commit eae17cd

Please sign in to comment.