Skip to content

Fix Extract hanging on progress dialog when config dir is missing#313

Open
piotte13 wants to merge 1 commit into
MaxLastBreath:mainfrom
piotte13:fix/extract-hangs-on-missing-config-dir
Open

Fix Extract hanging on progress dialog when config dir is missing#313
piotte13 wants to merge 1 commit into
MaxLastBreath:mainfrom
piotte13:fix/extract-hangs-on-missing-config-dir

Conversation

@piotte13

Copy link
Copy Markdown

Summary

Extract stuck on MacOS

  • The Extract flow builds an .ini path at <ini_file_path>/<configName>.ini but only the parent of ini_file_path was being created. On a fresh extract that target dir doesn't exist yet, so open(configFile, "w+") raises FileNotFoundError.
  • The exception kills the worker thread before ProgressBar.End() runs, leaving the "Downloading / NX-Optimizer Patching..." window visible forever and the UI unresponsive (reproduced on macOS arm64).

Changes

  • src/modules/GameManager/FileManager.pyos.makedirs(os.path.dirname(configFile), exist_ok=True) now runs after configFile is computed, so the actual containing directory is created (not just its parent). Works for both the legacy "Keys" path (where configFile == ini_file_path) and the new per-config layout.
  • src/modules/FrontEnd/ProgressBar.py — wrap the task callable in a try/except. If the worker crashes, schedule Destroy on the Tk thread via after(0, …) so the progress window closes instead of stranding the UI. Errors are still logged.

Test plan

  • Extract on macOS (Apple Silicon) with TOTK selected — completes, "Extracted Files/!!!!TOTK Optimizer/UltraCam/TOTK/Config/UI.ini" is written, progress window closes.
  • Forced an exception inside run_tasks — progress window now closes; previously it hung.
  • Extract on Windows / Linux to confirm no regression for the "Keys" legacy path.

The Extract flow builds an .ini path under <ini_file_path>/<configName>.ini,
but only the parent of <ini_file_path> was being created, so opening the
.ini for write raised FileNotFoundError. The exception killed the worker
thread before ProgressBar.End() ran, leaving the "Downloading" dialog
visible forever and the UI unresponsive.

- FileManager.submit: ensure os.path.dirname(configFile) exists right
  before opening it for write, so the actual containing directory is
  created (not just its parent).
- ProgressBar.Run: wrap the task callable in a try/except that schedules
  Destroy on the Tk thread if the worker crashes, so any future thread
  fault closes the progress window instead of hanging the UI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant