mirror of
https://github.com/lutris/lutris
synced 2024-10-02 22:14:23 +00:00
Add args, exit and working_dir options to dosexec
This commit is contained in:
parent
04b330704f
commit
6b66064831
|
@ -275,7 +275,6 @@ Currently, the following tasks are implemented:
|
|||
executable: drive_c/Program Files/Game/Game.exe
|
||||
args: --windowed
|
||||
|
||||
|
||||
* wine / winesteam: ``winetricks`` Runs winetricks with the ``app`` argument.
|
||||
``prefix`` is an optional WINEPREFIX path.
|
||||
|
||||
|
@ -315,6 +314,23 @@ Currently, the following tasks are implemented:
|
|||
prefix: $GAMEDIR
|
||||
filename: myregfile
|
||||
|
||||
* dosbox: ``dosexec`` Runs dosbox. Parameters are ``executable`` (optional
|
||||
``file ID`` or path to executable), ``config_file``
|
||||
(optional ``file ID`` or path to .conf file), ``args`` (optional command
|
||||
arguments), ``working_dir`` (optional working directory, defaults to the
|
||||
``executable``'s dir or the ``config_file``'s dir), ``exit`` (set to
|
||||
``false`` to prevent DOSBox to exit when the ``executable`` is terminated).
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
- task:
|
||||
name: dosexec
|
||||
executable: file_id
|
||||
config: $GAMEDIR/game_install.conf
|
||||
args: -scaler normal3x -conf more_conf.conf
|
||||
|
||||
Displaying a drop-down menu with options
|
||||
----------------------------------------
|
||||
|
||||
|
|
|
@ -6,16 +6,26 @@ from lutris.util.log import logger
|
|||
from lutris.runners.runner import Runner
|
||||
|
||||
|
||||
def dosexec(config_file=None, executable=None):
|
||||
def dosexec(config_file=None, executable=None, args=None, exit=True,
|
||||
working_dir=None):
|
||||
"""Execute Dosbox with given config_file"""
|
||||
logger.debug("Running dosbox with config %s" % config_file)
|
||||
dbx = dosbox()
|
||||
command = '"{}"'.format(dbx.get_executable())
|
||||
if config_file:
|
||||
command += ' -conf "{}"'.format(config_file)
|
||||
if not working_dir:
|
||||
working_dir = os.path.dirname(config_file)
|
||||
if executable:
|
||||
command += ' "{}"'.format(executable)
|
||||
subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).communicate()
|
||||
if not working_dir:
|
||||
working_dir = os.path.dirname(executable)
|
||||
if args:
|
||||
command += ' ' + args
|
||||
if exit:
|
||||
command += " -exit"
|
||||
subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
|
||||
cwd=working_dir).communicate()
|
||||
|
||||
|
||||
class dosbox(Runner):
|
||||
|
|
Loading…
Reference in a new issue