tmp/tmpyba4z48p/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Copy file <a id="fs.op.copy_file">[[fs.op.copy_file]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
bool copy_file(const path& from, const path& to);
|
| 5 |
+
bool copy_file(const path& from, const path& to, error_code& ec) noexcept;
|
| 6 |
+
```
|
| 7 |
+
|
| 8 |
+
*Returns:* `copy_file(from, to, copy_options::none)` or
|
| 9 |
+
`copy_file(from, to, copy_options::none, ec)`, respectively.
|
| 10 |
+
|
| 11 |
+
*Throws:* As specified in [[fs.err.report]].
|
| 12 |
+
|
| 13 |
+
``` cpp
|
| 14 |
+
bool copy_file(const path& from, const path& to, copy_options options);
|
| 15 |
+
bool copy_file(const path& from, const path& to, copy_options options,
|
| 16 |
+
error_code& ec) noexcept;
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
*Requires:* At most one element from each option group
|
| 20 |
+
([[fs.enum.copy.opts]]) is set in `options`.
|
| 21 |
+
|
| 22 |
+
*Effects:* As follows:
|
| 23 |
+
|
| 24 |
+
- Report a file already exists error as specified in [[fs.err.report]]
|
| 25 |
+
if:
|
| 26 |
+
- `!is_regular_file(from)`, or
|
| 27 |
+
- `exists(to)` and `!is_regular_file(to)`, or
|
| 28 |
+
- `exists(to)` and `equivalent(from, to)`, or
|
| 29 |
+
- `exists(to)` and
|
| 30 |
+
``` cpp
|
| 31 |
+
(options & (copy_options::skip_existing |
|
| 32 |
+
copy_options::overwrite_existing |
|
| 33 |
+
copy_options::update_existing)) == copy_options::none
|
| 34 |
+
```
|
| 35 |
+
- Otherwise, copy the contents and attributes of the file `from`
|
| 36 |
+
resolves to, to the file `to` resolves to, if:
|
| 37 |
+
- `!exists(to)`, or
|
| 38 |
+
- `(options & copy_options::overwrite_existing) != copy_options::none`,
|
| 39 |
+
or
|
| 40 |
+
- `(options & copy_options::update_existing) `` `` != copy_options::none`
|
| 41 |
+
and `from` is more recent than `to`, determined as if by use of the
|
| 42 |
+
`last_write_time` function ([[fs.op.last_write_time]]).
|
| 43 |
+
- Otherwise, no effects.
|
| 44 |
+
|
| 45 |
+
*Returns:* `true` if the `from` file was copied, otherwise `false`. The
|
| 46 |
+
signature with argument `ec` returns `false` if an error occurs.
|
| 47 |
+
|
| 48 |
+
*Throws:* As specified in [[fs.err.report]].
|
| 49 |
+
|
| 50 |
+
*Complexity:* At most one direct or indirect invocation of `status(to)`.
|
| 51 |
+
|