Skip to content

Commit

Permalink
Fix crash w/ GUI if Proton install is incomplete
Browse files Browse the repository at this point in the history
Fix Protontricks GUI crashing if the Proton installation used by the
game is incomplete. We already show a human-readable error message in
the CLI use case, so do the same for the GUI.

Refs #274
  • Loading branch information
Matoking committed Jan 16, 2024
1 parent de708dc commit e7a5412
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Fix Protontricks crash when custom Proton has an empty `compatibilitytool.vdf` manifest
- Fix Protontricks GUI crash when Proton installation is incomplete

## [1.11.0] - 2023-12-30
### Added
Expand Down
7 changes: 7 additions & 0 deletions src/protontricks/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,13 @@ def exit_(error):
if not proton_app:
exit_("Proton installation could not be found!")

if not proton_app.is_proton_ready:
exit_(
"Proton installation is incomplete. Have you launched a Steam "
"app using this Proton version at least once to finish the "
"installation?"
)

run_command(
winetricks_path=winetricks_path,
proton_app=proton_app,
Expand Down
19 changes: 19 additions & 0 deletions tests/cli/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,25 @@ def test_run_gui_no_games(self, cli, default_proton):

assert "Found no games" in result

def test_run_gui_proton_incomplete(
self, cli, steam_app_factory, default_proton, gui_provider):
"""
Try running Protontricks GUI using a Proton installation that
is incomplete because it hasn't been launched yet.
"""
# Remove the 'dist' directory to make the Proton installation
# incomplete
shutil.rmtree(str(default_proton.install_path / "dist"))

steam_app_factory(name="Fake game", appid=10)

# Fake the user selecting the game
gui_provider.mock_stdout = "Fake game 1: 10"

result = cli(["--gui"], expect_returncode=1)

assert "Proton installation is incomplete" in result


class TestCLICommand:
def test_run_command(
Expand Down

0 comments on commit e7a5412

Please sign in to comment.