mirror of
https://github.com/lutris/lutris
synced 2024-10-02 22:14:23 +00:00
Add working_dir param to "execute" directive
This commit is contained in:
parent
448d7bee30
commit
747377e5d9
|
@ -193,7 +193,7 @@ Example:
|
|||
Making a file executable
|
||||
------------------------
|
||||
|
||||
Marking the file as executable is done with the ``chmodx`` command. It is often
|
||||
Marking the file as executable is done with the ``chmodx`` directive. It is often
|
||||
needed for games that ship in a zip file, which does not retain file
|
||||
permissions.
|
||||
|
||||
|
@ -204,7 +204,8 @@ Executing a file
|
|||
|
||||
Execute files with the ``execute`` directive. Use the ``file`` parameter to
|
||||
reference a ``file id`` or a path, ``args`` to add command arguments,
|
||||
``terminal`` (set to "true") to execute in a new terminal window.
|
||||
``terminal`` (set to "true") to execute in a new terminal window, ``working_dir``
|
||||
to set the directory to execute the command in (defaults to the install path).
|
||||
The command is executed within the Lutris Runtime (resolving most shared
|
||||
library dependencies). The file is made executable if necessary, no need to run
|
||||
chmodx before.
|
||||
|
|
|
@ -53,6 +53,7 @@ class CommandsMixin(object):
|
|||
"""Run an executable file."""
|
||||
args = []
|
||||
terminal = None
|
||||
working_dir = None
|
||||
if isinstance(data, dict):
|
||||
self._check_required_params('file', data, 'execute')
|
||||
file_ref = data['file']
|
||||
|
@ -60,6 +61,7 @@ class CommandsMixin(object):
|
|||
for arg in shlex.split(args_string):
|
||||
args.append(self._substitute(arg))
|
||||
terminal = data.get('terminal')
|
||||
working_dir = data.get('working_dir')
|
||||
else:
|
||||
file_ref = data
|
||||
|
||||
|
@ -77,6 +79,9 @@ class CommandsMixin(object):
|
|||
if terminal:
|
||||
terminal = system.get_default_terminal()
|
||||
|
||||
if not working_dir or not os.path.exists(working_dir):
|
||||
working_dir = self.target_path
|
||||
|
||||
command = [exec_path] + args
|
||||
logger.debug("Executing %s" % command)
|
||||
thread = LutrisThread(command, env=runtime.get_env(), term=terminal,
|
||||
|
|
Loading…
Reference in a new issue