Skip to content

Commit

Permalink
support backup logs folder and config.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
gorouflex authored Feb 24, 2024
1 parent 70344d5 commit 955c04f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions UXTU4Mac/Assets/Updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ def update():
current_dir = os.path.dirname(os.path.dirname(script_dir))
current_folder = os.path.join(current_dir, "UXTU4Mac")
new_folder = os.path.join(current_dir, "UXTU4Mac_new")
config_file = os.path.join(current_folder, "config.ini")
backup_config = os.path.join(current_dir, "config.ini.bak")
logs_folder = os.path.join(current_folder, "Logs")
backup_logs = os.path.join(current_dir, "Logs.bak")

if os.path.exists(config_file):
shutil.copy2(config_file, backup_config)
if os.path.exists(logs_folder):
shutil.copytree(logs_folder, backup_logs)

urllib.request.urlretrieve(url, os.path.join(current_dir, "UXTU4Mac.zip"))
with zipfile.ZipFile(os.path.join(current_dir, "UXTU4Mac.zip"), 'r') as zip_ref:
zip_ref.extractall(new_folder)
Expand All @@ -22,5 +32,10 @@ def update():
subprocess.call(['chmod', '+x', os.path.join(current_dir, "UXTU4Mac", "UXTU4Mac.command")])
subprocess.call(['chmod', '+x', os.path.join(current_dir, "UXTU4Mac", "Assets", "ryzenadj")])

if os.path.exists(backup_config):
shutil.move(backup_config, config_file)
if os.path.exists(backup_logs):
shutil.move(backup_logs, logs_folder)

if __name__ == "__main__":
update()

0 comments on commit 955c04f

Please sign in to comment.