From 980bac5c4e76634640c71d5fd0f0c0c38de06d91 Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:26:38 +0200 Subject: [PATCH] LaunchSettings: Fix browsing the wrong directory if override exe is set The dialog would default to CWD because the contents of the line edit where not an absolute path. --- rare/components/tabs/games/game_info/game_settings.py | 4 ++-- rare/widgets/indicator_edit.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rare/components/tabs/games/game_info/game_settings.py b/rare/components/tabs/games/game_info/game_settings.py index 3461c764..38413b6d 100644 --- a/rare/components/tabs/games/game_info/game_settings.py +++ b/rare/components/tabs/games/game_info/game_settings.py @@ -85,10 +85,10 @@ class GameLaunchSettings(LaunchSettingsBase): if self.igame: self.offline_combo.setEnabled(self.igame.can_run_offline) - self.override_exe_edit.set_root(self.igame.install_path) + self.override_exe_edit.setRootPath(self.igame.install_path) else: self.offline_combo.setEnabled(False) - self.override_exe_edit.set_root("") + self.override_exe_edit.setRootPath(os.path.expanduser("~/")) launch_params = config.get_option(self.app_name, "start_params", "") self.launch_params_edit.setText(launch_params) diff --git a/rare/widgets/indicator_edit.py b/rare/widgets/indicator_edit.py index 0255069a..6b0e7338 100644 --- a/rare/widgets/indicator_edit.py +++ b/rare/widgets/indicator_edit.py @@ -317,13 +317,13 @@ class PathEdit(IndicatorLineEdit): self.path_select.clicked.connect(self.__set_path) - def set_root(self, path: str): + def setRootPath(self, path: str): self.__root_path = path self.__completer_model.setRootPath(path) def __set_path(self): dlg_path = self.line_edit.text() - if not dlg_path: + if not dlg_path or not os.path.isabs(dlg_path): dlg_path = self.__root_path dlg = QFileDialog(self, self.tr("Choose path"), dlg_path) dlg.setOption(QFileDialog.DontUseCustomDirectoryIcons)