From c0836fa193c10ede891308063f26d9d891b70c9f Mon Sep 17 00:00:00 2001 From: NoahOnFyre Date: Sun, 14 May 2023 16:40:29 +0200 Subject: [PATCH] Fixed backup system for updates --- main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 812ab17..7087352 100644 --- a/main.py +++ b/main.py @@ -24,7 +24,7 @@ from pytube import YouTube init(convert=True) -CURRENT_FYUTILS_VERSION = "1.7.3" +CURRENT_FYUTILS_VERSION = "1.7.6" SUPPORTED_FUEL_VERSION = 1 @@ -867,13 +867,14 @@ def menu(): if update_available: print(prefix("INFO", "Updater") + "Update found!") print(prefix("INFO", "Updater") + "Version Comparison: " + false_color() + version + accent_color() + " => " + true_color() + newest_version + text_color() + "...") - shutil.copy(current_dir + "main.py", tmp_dir) - os.rename(current_dir + "\\main.py", current_dir + "\\BACKUP-" + version + ".py") + shutil.copy(current_dir + "\\main.py", tmp_dir + "\\BACKUP-" + version + ".py") newest_file_content = requests.get(release_download_url).content - open(current_dir + "\\main.py", mode="wb").write(newest_file_content) + temp = open(current_dir + "\\main.py", mode="wb") + temp.write(newest_file_content) print(prefix("INFO", "Updater") + "Update successfully installed!") time.sleep(0.25) print(prefix("INFO", "Updater") + "Restarting FyUTILS...") + temp.close() time.sleep(1) os.system("start " + current_dir + "\\main.py") sys.exit(512)