From 23119dedc93ecd3b29c4c173ba5c990757c7cd27 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Wed, 18 May 2022 20:11:14 -0600 Subject: [PATCH] Add better CLI error handling --- CHANGELOG.md | 2 +- resources/constants.py | 1 + resources/main.py | 1 + resources/sys_patch.py | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fc548012..ce9e745b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ - Applicable for BCM2046 and BCM2070 chipsets - Fix backported to 0.4.5 release - GUI Enhancements: - - Greatly speed up GUI load times (300-800% on average) + - Greatly improve GUI load times (300-800% on average) ## 0.4.5 - Fix AutoPatcher.pkg download on releases diff --git a/resources/constants.py b/resources/constants.py index 048bc001b..c1e71c114 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -107,6 +107,7 @@ class Constants: self.ignore_updates = False # Ignore OCLP updates self.wxpython_variant = False # Determine if using wxPython variant self.unpack_thread = None # Determine if unpack thread finished + self.cli_mode = False # Determine if running in CLI mode ## Hardware self.computer: device_probe.Computer = None # type: ignore diff --git a/resources/main.py b/resources/main.py index 47ac4ac4d..ca79a5911 100644 --- a/resources/main.py +++ b/resources/main.py @@ -53,6 +53,7 @@ class OpenCoreLegacyPatcher: ignore_args = ["--auto_patch", "--gui_patch", "--gui_unpatch"] if not any(x in sys.argv for x in ignore_args): self.constants.current_path = Path.cwd() + self.constants.cli_mode = True if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"): print("- Rerouting payloads location") self.constants.payload_path = sys._MEIPASS / Path("payloads") diff --git a/resources/sys_patch.py b/resources/sys_patch.py index 1225ee949..c08989839 100644 --- a/resources/sys_patch.py +++ b/resources/sys_patch.py @@ -309,7 +309,7 @@ class PatchSysVolume: return output def download_files(self): - if self.constants.gui_mode is False or "Library/InstallerSandboxes/" in str(self.constants.payload_path): + if self.constants.cli_mode is True: download_result, link = sys_patch_download.grab_patcher_support_pkg(self.constants).download_files() else: download_result = True