From 657bd5018a646624247853fedb97f77890b02a51 Mon Sep 17 00:00:00 2001 From: Xodetaetl Date: Thu, 21 Aug 2014 20:05:12 +0200 Subject: [PATCH] Add working_dir setting to Wine and Linux runners --- docs/installers.rst | 12 +++++++++--- lutris/runners/linux.py | 9 +++++++++ lutris/runners/wine.py | 9 +++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/docs/installers.rst b/docs/installers.rst index c1aa6b709..6158932e0 100644 --- a/docs/installers.rst +++ b/docs/installers.rst @@ -57,11 +57,17 @@ Presetting game parameters The ``game`` directive lets you preset game parameters and options. Available parameters depend on the runner: -* linux: ``args`` (optional main executable command argument) +* linux: ``args`` (optional command arguments), ``working_dir`` + (optional working directory, defaults to the exe's dir). -* wine / winesteam: ``args``, ``prefix`` (optional WINEPREFIX). +* wine: ``args``, ``prefix`` (optional Wine prefix), ``working_dir`` (optional + working directory, defaults to the exe's dir). -[TODO: reference all options] +* winesteam: ``args``, ``prefix`` (optional Wine prefix). + +[TODO: reference all options] Meanwhile, you can check the configuration window +of any game using the runner you're writing for to get a list of the available +options. Example: diff --git a/lutris/runners/linux.py b/lutris/runners/linux.py index fe597fa09..895bfbce2 100644 --- a/lutris/runners/linux.py +++ b/lutris/runners/linux.py @@ -19,6 +19,12 @@ class linux(Runner): "type": "string", "label": "Arguments" }, + { + "option": "working_dir", + "type": "directory_chooser", + "label": "Working directory" + }, + { "option": "ld_preload", "type": "file", @@ -54,6 +60,9 @@ class linux(Runner): @property def working_dir(self): """Return the working directory to use when running the game.""" + option = self.config['game'].get('working_dir') + if option: + return option if self.game_exe: return os.path.dirname(self.game_exe) else: diff --git a/lutris/runners/wine.py b/lutris/runners/wine.py index 17213e5e8..0c20dedd5 100644 --- a/lutris/runners/wine.py +++ b/lutris/runners/wine.py @@ -112,6 +112,12 @@ class wine(Runner): 'type': 'string', 'label': 'Arguments' }, + { + "option": "working_dir", + "type": "directory_chooser", + "label": "Working directory" + }, + { 'option': 'prefix', 'type': 'directory_chooser', @@ -247,6 +253,9 @@ class wine(Runner): @property def working_dir(self): """Return the working directory to use when running the game.""" + option = self.config['game'].get('working_dir') + if option: + return option if self.game_exe: return os.path.dirname(self.game_exe) else: