diff --git a/src/modules/FrontEnd/ProgressBar.py b/src/modules/FrontEnd/ProgressBar.py index 9820ba3..b468b46 100644 --- a/src/modules/FrontEnd/ProgressBar.py +++ b/src/modules/FrontEnd/ProgressBar.py @@ -32,8 +32,15 @@ def Run(cls, window, tasks): label.pack(pady=10) cls.progress_bar = ttk.Progressbar(cls.progress_window, mode="determinate", maximum=total_iterations) cls.progress_bar.pack(pady=20) - task_thread = threading.Thread(target=tasks) - task_thread.start() + def _safe_tasks(): + try: + tasks() + except Exception as e: + log.error(f"Task thread crashed: {e!r}") + cls.progress_window.after(0, cls.Destroy) + + task_thread = threading.Thread(target=_safe_tasks) + task_thread.start() @classmethod def Destroy(cls): diff --git a/src/modules/GameManager/FileManager.py b/src/modules/GameManager/FileManager.py index ba438b2..6471e4b 100644 --- a/src/modules/GameManager/FileManager.py +++ b/src/modules/GameManager/FileManager.py @@ -545,6 +545,8 @@ def Create_Mod_Patch(mode: str | None = None): else: configFile = ini_file_path ## compatibility for old patches + os.makedirs(os.path.dirname(configFile), exist_ok=True) + if os.path.exists(configFile): config.read(configFile, encoding="utf-8")