Add working_dir setting to Wine and Linux runners

This commit is contained in:
Xodetaetl 2014-08-21 20:05:12 +02:00 committed by Mathieu Comandon
parent 90c8dbe0bb
commit 657bd5018a
3 changed files with 27 additions and 3 deletions

View file

@ -57,11 +57,17 @@ Presetting game parameters
The ``game`` directive lets you preset game parameters and options. Available The ``game`` directive lets you preset game parameters and options. Available
parameters depend on the runner: 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: Example:

View file

@ -19,6 +19,12 @@ class linux(Runner):
"type": "string", "type": "string",
"label": "Arguments" "label": "Arguments"
}, },
{
"option": "working_dir",
"type": "directory_chooser",
"label": "Working directory"
},
{ {
"option": "ld_preload", "option": "ld_preload",
"type": "file", "type": "file",
@ -54,6 +60,9 @@ class linux(Runner):
@property @property
def working_dir(self): def working_dir(self):
"""Return the working directory to use when running the game.""" """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: if self.game_exe:
return os.path.dirname(self.game_exe) return os.path.dirname(self.game_exe)
else: else:

View file

@ -112,6 +112,12 @@ class wine(Runner):
'type': 'string', 'type': 'string',
'label': 'Arguments' 'label': 'Arguments'
}, },
{
"option": "working_dir",
"type": "directory_chooser",
"label": "Working directory"
},
{ {
'option': 'prefix', 'option': 'prefix',
'type': 'directory_chooser', 'type': 'directory_chooser',
@ -247,6 +253,9 @@ class wine(Runner):
@property @property
def working_dir(self): def working_dir(self):
"""Return the working directory to use when running the game.""" """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: if self.game_exe:
return os.path.dirname(self.game_exe) return os.path.dirname(self.game_exe)
else: else: