1
0
Fork 0
mirror of synced 2024-05-04 20:52:58 +12:00

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.
This commit is contained in:
loathingKernel 2024-02-22 17:26:38 +02:00
parent d397912247
commit 980bac5c4e
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD
2 changed files with 4 additions and 4 deletions

View file

@ -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)

View file

@ -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)