Skip to content

Commit b271725

Browse files
committed
Fixed program crashing on startup after Update of Updater
1 parent ac069c7 commit b271725

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,4 @@ When you have both installed, run the following commands in the root folder:
1717
pyinstaller --onefile --windowed --icon=VexTrack.ico src/VexTrack.py
1818
pyinstaller --onefile --windowed --icon=VexTrack.ico src/Updater.py
1919

20-
The compiled .exe files are in a new folder "dist". Move them to the desired location and create one more file in the same folder as the .exe files called "version" without any file extension with the following contents:
21-
22-
<VexTrack Version>
23-
<Updater Version>
24-
25-
Where <VexTrack Version> is the version string of the latest version of VexTrack (e.g. "v1.3") and <Updater Version> is the version string of the latest version of the Updater (e.g. "v1.1")
26-
To see which versions are the latest, ![click here](https://github.com/BitTim/VexTrack/releases)
20+
The compiled .exe files are in a new folder "dist". Move them to the desired location and move the file "version" into the same folder as the .exe files

src/updaterUpdate.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
def downloadNewUpdaterVersion(versionString):
1111
os.system("taskkill /f /im " + "Updater.exe")
1212

13-
url = "https://github.com/" + GITHUB_USER + "/" + GITHUB_REPO + "/releases/download/" + versionString + "/" + "Updater.exe"
13+
url = "https://github.com/" + GITHUB_USER + "/" + GITHUB_REPO + "/releases/download/U" + versionString + "/" + "Updater.exe"
1414
r = requests.get(url)
1515

1616
with open("Updater.exe", 'wb') as f:
@@ -19,20 +19,26 @@ def downloadNewUpdaterVersion(versionString):
1919
content = []
2020
with open(VERSION_PATH, 'r') as f:
2121
content = f.readlines()
22-
23-
if len(content) < 2:
24-
content.append("v1.0")
2522

2623
content[1] = versionString
27-
for i in range(0, len(content)):
28-
if i != len(content) - 1: content[i] += "\n"
29-
3024
with open(VERSION_PATH, 'w') as f:
3125
f.writelines(content)
3226

3327
def checkNewUpdaterVersion():
28+
content = []
3429
with open(VERSION_PATH, 'r') as f:
35-
versionString = f.readlines()[1]
30+
content = f.readlines()
31+
32+
if len(content) < 2:
33+
content.append("v1.0")
34+
35+
for i in range(0, len(content)):
36+
if i != len(content) - 1: content[i] += "\n"
37+
38+
with open(VERSION_PATH, 'w') as f:
39+
f.writelines(content)
40+
41+
versionString = content[1]
3642

3743
versionNumber = versionString.split("v")[1]
3844
response = requests.get("https://api.github.com/repos/" + GITHUB_USER + "/" + GITHUB_REPO + "/releases")

0 commit comments

Comments
 (0)