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:
parent
d397912247
commit
980bac5c4e
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue