From 23c0759d7a175db0d0b477f896f2c014c6a41bea Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sun, 20 Nov 2022 18:13:19 -0700 Subject: [PATCH] GUI: Replace app after checking updates --- gui/gui_main.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gui/gui_main.py b/gui/gui_main.py index 986027a73..00abba84c 100644 --- a/gui/gui_main.py +++ b/gui/gui_main.py @@ -183,10 +183,7 @@ class wx_python_gui: self.popup.ShowModal() else: # Spawn thread to check for updates - if self.check_for_local_installs() is True: - self.OnCloseFrame() - else: - threading.Thread(target=self.check_for_updates).start() + threading.Thread(target=self.check_for_updates).start() def check_for_local_installs(self, event=None): # Update app in '/Library/Application Support/Dortania' folder @@ -276,14 +273,16 @@ class wx_python_gui: subprocess.run(["xattr", "-cr", "/Library/Application Support/Dortania/OpenCore-Patcher.app"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) subprocess.run(["open", "/Library/Application Support/Dortania/OpenCore-Patcher.app"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - subprocess.run(["rm", "-R", path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + if "AppTranslocation" not in path: + subprocess.run(["rm", "-R", path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - return True + self.OnCloseFrame() def check_for_updates(self, event=None): if self.constants.has_checked_updates is True: return + did_find_update = False ignore_updates = global_settings.global_settings().read_property("IgnoreAppUpdates") if ignore_updates is not True: self.constants.ignore_updates = False @@ -302,6 +301,7 @@ class wx_python_gui: ) self.dialog.SetYesNoCancelLabels("View on Github", "Always Ignore", "Ignore Once") response = self.dialog.ShowModal() + did_find_update = True if response == wx.ID_YES: webbrowser.open(github_link) elif response == wx.ID_NO: @@ -312,6 +312,9 @@ class wx_python_gui: self.constants.ignore_updates = True print("- Ignoring App Updates due to defaults") + if did_find_update is False: + self.check_for_local_installs() + def relaunch_as_root(self, event=None): # Add Dialog Box asking if it's ok to relaunch as root