tmp/tmphrpi544c/{from.md → to.md}
RENAMED
|
@@ -5,23 +5,23 @@ void copy(const path& from, const path& to);
|
|
| 5 |
```
|
| 6 |
|
| 7 |
*Effects:* Equivalent to `copy(from, to, copy_options::none)`.
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
-
void copy(const path& from, const path& to, error_code& ec)
|
| 11 |
```
|
| 12 |
|
| 13 |
*Effects:* Equivalent to `copy(from, to, copy_options::none, ec)`.
|
| 14 |
|
| 15 |
``` cpp
|
| 16 |
void copy(const path& from, const path& to, copy_options options);
|
| 17 |
void copy(const path& from, const path& to, copy_options options,
|
| 18 |
-
error_code& ec)
|
| 19 |
```
|
| 20 |
|
| 21 |
-
*
|
| 22 |
-
|
| 23 |
|
| 24 |
*Effects:* Before the first use of `f` and `t`:
|
| 25 |
|
| 26 |
- If
|
| 27 |
``` cpp
|
|
@@ -42,17 +42,17 @@ void copy(const path& from, const path& to, copy_options options,
|
|
| 42 |
`auto t = status(to)`.
|
| 43 |
|
| 44 |
Effects are then as follows:
|
| 45 |
|
| 46 |
- If `f.type()` or `t.type()` is an implementation-defined file
|
| 47 |
-
type
|
| 48 |
*implementation-defined*.
|
| 49 |
- Otherwise, an error is reported as specified in [[fs.err.report]] if:
|
| 50 |
-
- `
|
| 51 |
-
- `equivalent(from, to)`, or
|
| 52 |
-
- `is_other(f) || is_other(t)`, or
|
| 53 |
-
- `is_directory(f) && is_regular_file(t)`.
|
| 54 |
- Otherwise, if `is_symlink(f)`, then:
|
| 55 |
- If `(options & copy_options::skip_symlinks) != copy_options::none`
|
| 56 |
then return.
|
| 57 |
- Otherwise if
|
| 58 |
``` cpp
|
|
@@ -72,24 +72,36 @@ Effects are then as follows:
|
|
| 72 |
`(options & copy_options::create_hard_links) != copy_options::none`,
|
| 73 |
then create a hard link to the source file.
|
| 74 |
- Otherwise, if `is_directory(t)`, then
|
| 75 |
`copy_file(from, to/from.filename(), options)`.
|
| 76 |
- Otherwise, `copy_file(from, to, options)`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
- Otherwise, if
|
| 78 |
``` cpp
|
| 79 |
is_directory(f) &&
|
| 80 |
((options & copy_options::recursive) != copy_options::none ||
|
| 81 |
options == copy_options::none)
|
| 82 |
```
|
| 83 |
|
| 84 |
then:
|
| 85 |
-
- If `
|
| 86 |
- Then, iterate over the files in `from`, as if by
|
| 87 |
``` cpp
|
| 88 |
for (const directory_entry& x : directory_iterator(from))
|
| 89 |
-
copy(x.path(), to/x.path().filename(),
|
|
|
|
| 90 |
```
|
|
|
|
|
|
|
|
|
|
| 91 |
- Otherwise, for the signature with argument `ec`, `ec.clear()`.
|
| 92 |
- Otherwise, no effects.
|
| 93 |
|
| 94 |
*Throws:* As specified in [[fs.err.report]].
|
| 95 |
|
|
|
|
| 5 |
```
|
| 6 |
|
| 7 |
*Effects:* Equivalent to `copy(from, to, copy_options::none)`.
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
+
void copy(const path& from, const path& to, error_code& ec);
|
| 11 |
```
|
| 12 |
|
| 13 |
*Effects:* Equivalent to `copy(from, to, copy_options::none, ec)`.
|
| 14 |
|
| 15 |
``` cpp
|
| 16 |
void copy(const path& from, const path& to, copy_options options);
|
| 17 |
void copy(const path& from, const path& to, copy_options options,
|
| 18 |
+
error_code& ec);
|
| 19 |
```
|
| 20 |
|
| 21 |
+
*Preconditions:* At most one element from each option
|
| 22 |
+
group [[fs.enum.copy.opts]] is set in `options`.
|
| 23 |
|
| 24 |
*Effects:* Before the first use of `f` and `t`:
|
| 25 |
|
| 26 |
- If
|
| 27 |
``` cpp
|
|
|
|
| 42 |
`auto t = status(to)`.
|
| 43 |
|
| 44 |
Effects are then as follows:
|
| 45 |
|
| 46 |
- If `f.type()` or `t.type()` is an implementation-defined file
|
| 47 |
+
type [[fs.enum.file.type]], then the effects are
|
| 48 |
*implementation-defined*.
|
| 49 |
- Otherwise, an error is reported as specified in [[fs.err.report]] if:
|
| 50 |
+
- `exists(f)` is `false`, or
|
| 51 |
+
- `equivalent(from, to)` is `true`, or
|
| 52 |
+
- `is_other(f) || is_other(t)` is `true`, or
|
| 53 |
+
- `is_directory(f) && is_regular_file(t)` is `true`.
|
| 54 |
- Otherwise, if `is_symlink(f)`, then:
|
| 55 |
- If `(options & copy_options::skip_symlinks) != copy_options::none`
|
| 56 |
then return.
|
| 57 |
- Otherwise if
|
| 58 |
``` cpp
|
|
|
|
| 72 |
`(options & copy_options::create_hard_links) != copy_options::none`,
|
| 73 |
then create a hard link to the source file.
|
| 74 |
- Otherwise, if `is_directory(t)`, then
|
| 75 |
`copy_file(from, to/from.filename(), options)`.
|
| 76 |
- Otherwise, `copy_file(from, to, options)`.
|
| 77 |
+
- Otherwise, if
|
| 78 |
+
``` cpp
|
| 79 |
+
is_directory(f) &&
|
| 80 |
+
(options & copy_options::create_symlinks) != copy_options::none
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
then report an error with an `error_code` argument equal to
|
| 84 |
+
`make_error_code(errc::is_a_directory)`.
|
| 85 |
- Otherwise, if
|
| 86 |
``` cpp
|
| 87 |
is_directory(f) &&
|
| 88 |
((options & copy_options::recursive) != copy_options::none ||
|
| 89 |
options == copy_options::none)
|
| 90 |
```
|
| 91 |
|
| 92 |
then:
|
| 93 |
+
- If `exists(t)` is `false`, then `create_directory(to, from)`.
|
| 94 |
- Then, iterate over the files in `from`, as if by
|
| 95 |
``` cpp
|
| 96 |
for (const directory_entry& x : directory_iterator(from))
|
| 97 |
+
copy(x.path(), to/x.path().filename(),
|
| 98 |
+
options | copy_options::in-recursive-copy);
|
| 99 |
```
|
| 100 |
+
|
| 101 |
+
where *`in-recursive-copy`* is a bitmask element of `copy_options`
|
| 102 |
+
that is not one of the elements in [[fs.enum.copy.opts]].
|
| 103 |
- Otherwise, for the signature with argument `ec`, `ec.clear()`.
|
| 104 |
- Otherwise, no effects.
|
| 105 |
|
| 106 |
*Throws:* As specified in [[fs.err.report]].
|
| 107 |
|