Skip to content

Commit

Permalink
Fixed backup system for updates
Browse files Browse the repository at this point in the history
  • Loading branch information
noahzeisberg committed May 14, 2023
1 parent b66e58e commit c0836fa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c0836fa

Please sign in to comment.