Skip to content

Commit 545c50f

Browse files
The updater will now update within the same
directory making for a working traditional updater
1 parent 48e394e commit 545c50f

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

Updater.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_app_download_link(target_version):
2424

2525
def delete_contents():
2626
keep = ["Updater.exe", "database.json", "src", "userdata", "app.zip"]
27-
for root, dir, files in os.walk("./Scanner"):
27+
for root, dir, files in os.walk("./"):
2828
for name in files:
2929
if name not in keep:
3030
try:
@@ -39,6 +39,7 @@ def delete_contents():
3939

4040
def move_from_temp():
4141
temp_destination = GetLongPathName(tempfile.gettempdir())
42+
os.remove(temp_destination + "/Autoscanner/Updater.exe")
4243
shutil.copytree(
4344
temp_destination + "/Autoscanner",
4445
"./",
@@ -47,8 +48,8 @@ def move_from_temp():
4748

4849

4950
def check_scanner_folder():
50-
if not os.path.isdir("./Scanner"):
51-
os.mkdir("./Scanner")
51+
if not os.path.isdir("./"):
52+
os.mkdir("./")
5253
return
5354

5455

@@ -64,7 +65,7 @@ def create_shortcut():
6465
if "Autoscanner" in item:
6566
os.remove(desktop + "/" + item)
6667

67-
current_dir = os.path.abspath(os.getcwd() + "/Scanner/Autoscanner.exe")
68+
current_dir = os.path.abspath(os.getcwd() + "/Autoscanner.exe")
6869
current_dir = current_dir.split("\\")
6970
current_dir = "/".join(current_dir)
7071
# fmt: off
@@ -106,9 +107,9 @@ def clean():
106107

107108
def update():
108109
# compare versions
109-
check_scanner_folder()
110+
# check_scanner_folder()
110111
local_version = CheckDriver.get_local_version(
111-
"App_Version", filepath="./Scanner/src/versions.json"
112+
"App_Version", filepath="./src/versions.json"
112113
)
113114
remote_version = CheckDriver.get_webpage_content(LATEST_APP_VERSION)
114115

@@ -127,9 +128,9 @@ def update():
127128
)
128129
sleep(2)
129130
move_from_temp()
130-
CheckDriver.check_file(filepath="./Scanner/src/versions.json")
131+
CheckDriver.check_file(filepath="./src/versions.json")
131132
CheckDriver.update_version(
132-
remote_version, "App_Version", filepath="./Scanner/src/versions.json"
133+
remote_version, "App_Version", filepath="./src/versions.json"
133134
)
134135

135136
sleep(2)

build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
./venv/Scripts/Activate
1+
./.venv/Scripts/Activate
22
python.exe -m PyInstaller ./Updater.spec
33
python.exe -m PyInstaller ./Autoscanner.spec
44

build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import shutil
22

3-
shutil.copytree("./dist/Autoscanner/", "./dist/release/Scanner")
3+
shutil.copytree("./dist/Autoscanner/", "./dist/release/")
4+
shutil.move("./dist/Updater.exe", "./dist/release")
45
shutil.make_archive("./dist/Autoscanner", "zip", "./dist/release")

0 commit comments

Comments
 (0)