From 3e38cfdfd81b5719b65d828445ec4625627993ff Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Sat, 16 Dec 2023 10:58:48 -0500 Subject: [PATCH] Change get_command() to throw, not return an empty list, if the runner exe can't be found and flatpak has not got the runner. [] is no better than None here; all calls try to form command lines and run them, which only works for the Linux runner. --- lutris/gui/installerwindow.py | 8 ++++---- lutris/runners/runner.py | 14 ++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lutris/gui/installerwindow.py b/lutris/gui/installerwindow.py index d5e33595d..7f76a099f 100644 --- a/lutris/gui/installerwindow.py +++ b/lutris/gui/installerwindow.py @@ -218,9 +218,9 @@ class InstallerWindow(ModelessDialog, remove_checkbox = Gtk.CheckButton.new_with_label(_("Remove game files")) if self.interpreter and self.interpreter.target_path and \ - self.interpreter.game_dir_created and \ - self.installation_kind == InstallationKind.INSTALL and \ - is_removeable(self.interpreter.target_path, LutrisConfig().system_config): + self.interpreter.game_dir_created and \ + self.installation_kind == InstallationKind.INSTALL and \ + is_removeable(self.interpreter.target_path, LutrisConfig().system_config): remove_checkbox.set_active(self.interpreter.game_dir_created) remove_checkbox.show() widgets.append(remove_checkbox) @@ -932,7 +932,7 @@ class InstallerWindow(ModelessDialog, """Displays the continue button, but labels it 'Install'.""" self.display_continue_button(handler, continue_button_label=_( "_Install"), sensitive=sensitive, - extra_buttons=[self.source_button]) + extra_buttons=[self.source_button]) def display_cancel_button(self, extra_buttons=None): self.display_buttons(extra_buttons or []) diff --git a/lutris/runners/runner.py b/lutris/runners/runner.py index e06813271..384a83703 100644 --- a/lutris/runners/runner.py +++ b/lutris/runners/runner.py @@ -196,16 +196,18 @@ class Runner: # pylint: disable=too-many-public-methods return exe def get_command(self): + """Returns the command line to run the runner itself; generally a game + will be appended to this by play().""" try: exe = self.get_executable() - if system.path_exists(exe): - return [exe] + if not system.path_exists(exe): + raise MissingExecutableError(_("The executable '%s' could not be found.") % exe) + return [exe] except MisconfigurationError: - pass + if flatpak.is_app_installed(self.flatpak_id): + return flatpak.get_run_command(self.flatpak_id) - if flatpak.is_app_installed(self.flatpak_id): - return flatpak.get_run_command(self.flatpak_id) - return [] + raise def get_env(self, os_env=False, disable_runtime=False): """Return environment variables used for a game."""