diff options
Diffstat (limited to 'docs/markdown')
-rw-r--r-- | docs/markdown/Fs-module.md | 27 | ||||
-rw-r--r-- | docs/markdown/snippets/fs_copyfile.md | 17 |
2 files changed, 44 insertions, 0 deletions
diff --git a/docs/markdown/Fs-module.md b/docs/markdown/Fs-module.md index 663aba4..1393551 100644 --- a/docs/markdown/Fs-module.md +++ b/docs/markdown/Fs-module.md @@ -215,3 +215,30 @@ fs.stem('foo/bar/baz.dll.a') # baz.dll specified by `path` changes, this will trigger Meson to reconfigure the project. If the file specified by `path` is a `files()` object it cannot refer to a built file. + + +### copyfile + +*Since 0.64.0* + +Copy a file from the source directory to the build directory at build time + +Has the following positional arguments: + - src `File | str`: the file to copy + +Has the following optional arguments: + - dest `str`: the name of the output file. If unset will be the basename of + the src argument + +Has the following keyword arguments: + - install `bool`: Whether to install the copied file, defaults to false + - install_dir `str`: Where to install the file to + - install_tag: `str`: the install tag to assign to this target + - install_mode `array[str | int]`: the mode to install the file with + +returns: + - a [[custom_target]] object + +```meson +copy = fs.copyfile('input-file', 'output-file') +``` diff --git a/docs/markdown/snippets/fs_copyfile.md b/docs/markdown/snippets/fs_copyfile.md new file mode 100644 index 0000000..dfb5d89 --- /dev/null +++ b/docs/markdown/snippets/fs_copyfile.md @@ -0,0 +1,17 @@ +## `fs.copyfile` to replace `configure_file(copy : true)` + +A new method has been added to the `fs` module, `copyfile`. This method replaces +`configure_file(copy : true)`, but only copies files. Unlike `configure_file()` +it runs at build time, and the output name is optional defaulting to the +filename without paths of the input if unset: + +```meson +fs.copyfile('src/file.txt') +``` +Will create a file in the current build directory called `file.txt` + + +```meson +fs.copyfile('file.txt', 'outfile.txt') +``` +Will create a copy renamed to `outfile.txt` |