mirror of
https://github.com/lutris/lutris
synced 2024-10-02 22:14:23 +00:00
Document mode option for write_file + substitute file content
This commit is contained in:
parent
b1d22d05cd
commit
c2fc40a6a8
|
@ -269,7 +269,12 @@ Writing files
|
|||
Writing text files
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Create or overwrite a file with the ``write_file`` directive. Use the ``file`` (an absolute path or a ``file id``) and ``content`` parameters.
|
||||
Create or overwrite a file with the ``write_file`` directive. Use the ``file``
|
||||
(an absolute path or a ``file id``) and ``content`` parameters.
|
||||
|
||||
You can also use the optional parameter ``mode`` to specify a file write mode.
|
||||
Valid values for ``mode`` include ``w`` (the default, to write to a new file)
|
||||
or ``a`` to append data to an existing file.
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -486,7 +491,7 @@ Currently, the following tasks are implemented:
|
|||
arch: win64
|
||||
|
||||
* wine / winesteam: ``winekill`` Stops processes running in Wine prefix. Parameters
|
||||
are ``prefix`` (optional WINEPREFIX),
|
||||
are ``prefix`` (optional WINEPREFIX),
|
||||
``arch`` (optional architecture of the prefix, required when you created win64 prefix).
|
||||
|
||||
Example
|
||||
|
|
|
@ -384,9 +384,11 @@ class CommandsMixin(object):
|
|||
os.makedirs(basedir)
|
||||
|
||||
mode = params.get('mode', 'w')
|
||||
if not mode.startswith(('a', 'w')):
|
||||
raise ScriptingError("Wrong value for write_file mode: '%s'" % mode)
|
||||
|
||||
with open(file, mode) as f:
|
||||
f.write(params['content'])
|
||||
f.write(self._substitute(params['content']))
|
||||
|
||||
def write_json(self, params):
|
||||
"""Write data into a json file."""
|
||||
|
|
Loading…
Reference in a new issue