diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-02-28 14:25:10 -0800 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-08-18 16:53:36 -0400 |
commit | 991baf56e99d96bbe3f2841f4b7c283e36ff1c89 (patch) | |
tree | 8dc698ed09beee43e75251d4f3cb52562ab0eaec /docs/markdown/snippets | |
parent | f93886192eeeeaf93608e310f2bf061b56c2e4ad (diff) | |
download | meson-991baf56e99d96bbe3f2841f4b7c283e36ff1c89.zip meson-991baf56e99d96bbe3f2841f4b7c283e36ff1c89.tar.gz meson-991baf56e99d96bbe3f2841f4b7c283e36ff1c89.tar.bz2 |
modules/fs: Replace configure_file(copy:) with fs.copyfile
`configure_file` is both an extremely complicated implementation, and
a strange place for copying. It's a bit of a historical artifact, since
the fs module didn't yet exist. It makes more sense to move this to the
fs module and deprecate this `configure_file` version.
This new version works at build time rather than configure time, which
has the disadvantage it can't be passed to `run_command`, but with the
advantage that changes to the input don't require a full reconfigure.
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r-- | docs/markdown/snippets/fs_copyfile.md | 17 |
1 files changed, 17 insertions, 0 deletions
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` |