Init
This commit is contained in:
81
cppdraft/fs/op/absolute.md
Normal file
81
cppdraft/fs/op/absolute.md
Normal file
@@ -0,0 +1,81 @@
|
||||
[fs.op.absolute]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.absolute)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.absolute)
|
||||
|
||||
#### 31.12.13.2 Absolute [fs.op.absolute]
|
||||
|
||||
[ð](#lib:absolute)
|
||||
|
||||
`path filesystem::absolute(const path& p);
|
||||
path filesystem::absolute(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17173)
|
||||
|
||||
*Effects*: Composes an absolute path referencing the same file system location
|
||||
as p according to the operating system ([[fs.conform.os]](fs.conform.os "31.12.2.3 Operating system dependent behavior conformance"))[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17178)
|
||||
|
||||
*Returns*: The composed path[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns path() if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17183)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
For the returned path, rp, rp.is_absolute() is true unless an error occurs[.](#3.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17189)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17193)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
To resolve symlinks
|
||||
or perform other sanitization that can involve queries to secondary storage,
|
||||
such as hard disks, consider canonical ([[fs.op.canonical]](fs.op.canonical "31.12.13.3 Canonical"))[.](#5.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17200)
|
||||
|
||||
[*Note [3](#note-3)*:
|
||||
|
||||
Implementations are strongly encouraged to not query secondary storage,
|
||||
and not consider !exists(p) an error[.](#6.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17206)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
For POSIX-based operating systems,absolute(p) is simply current_path()/p[.](#7.sentence-1)
|
||||
|
||||
For Windows-based operating systems,absolute might have the same semantics as GetFullPathNameW[.](#7.sentence-2)
|
||||
|
||||
â *end example*]
|
||||
44
cppdraft/fs/op/canonical.md
Normal file
44
cppdraft/fs/op/canonical.md
Normal file
@@ -0,0 +1,44 @@
|
||||
[fs.op.canonical]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.canonical)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.canonical)
|
||||
|
||||
#### 31.12.13.3 Canonical [fs.op.canonical]
|
||||
|
||||
[ð](#lib:canonical)
|
||||
|
||||
`path filesystem::canonical(const path& p);
|
||||
path filesystem::canonical(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17224)
|
||||
|
||||
*Effects*: Converts p to an absolute
|
||||
path that has no symbolic link, dot, or dot-dot elements
|
||||
in its pathname in the generic format[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17230)
|
||||
|
||||
*Returns*: A path that refers to
|
||||
the same file system object as absolute(p)[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns path() if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17236)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17240)
|
||||
|
||||
*Remarks*: !exists(p) is an error[.](#4.sentence-1)
|
||||
216
cppdraft/fs/op/copy.md
Normal file
216
cppdraft/fs/op/copy.md
Normal file
@@ -0,0 +1,216 @@
|
||||
[fs.op.copy]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.copy)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.copy)
|
||||
|
||||
#### 31.12.13.4 Copy [fs.op.copy]
|
||||
|
||||
[ð](#lib:copy,path)
|
||||
|
||||
`void filesystem::copy(const path& from, const path& to);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17253)
|
||||
|
||||
*Effects*: Equivalent tocopy(from, to, copy_options::none)[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:copy,path_)
|
||||
|
||||
`void filesystem::copy(const path& from, const path& to, error_code& ec);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17265)
|
||||
|
||||
*Effects*: Equivalent tocopy(from, to, copy_options::none, ec)[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:copy,path__)
|
||||
|
||||
`void filesystem::copy(const path& from, const path& to, copy_options options);
|
||||
void filesystem::copy(const path& from, const path& to, copy_options options,
|
||||
error_code& ec);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17279)
|
||||
|
||||
*Preconditions*: At most one element from each option group ([[fs.enum.copy.opts]](fs.enum.copy.opts "31.12.8.3 Enum class copy_options"))
|
||||
is set in options[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17284)
|
||||
|
||||
*Effects*: Before the first use of f and t:
|
||||
|
||||
- [(4.1)](#4.1)
|
||||
|
||||
If(options & copy_options::create_symlinks) != copy_options::none ||(options & copy_options::skip_symlinks) != copy_options::none then auto f = symlink_status(from) and if needed auto t = symlink_status(to).
|
||||
|
||||
- [(4.2)](#4.2)
|
||||
|
||||
Otherwise, if(options & copy_options::copy_symlinks) != copy_options::none then auto f = symlink_status(from) and if needed auto t = status(to).
|
||||
|
||||
- [(4.3)](#4.3)
|
||||
|
||||
Otherwise, auto f = status(from) and if needed auto t = status(to).
|
||||
|
||||
Effects are then as follows:
|
||||
|
||||
- [(4.4)](#4.4)
|
||||
|
||||
If f.type() or t.type() is an implementation-defined
|
||||
file type ([[fs.enum.file.type]](fs.enum.file.type "31.12.8.2 Enum class file_type")), then the effects areimplementation-defined[.](#4.4.sentence-1)
|
||||
|
||||
- [(4.5)](#4.5)
|
||||
|
||||
Otherwise, an error is reported as specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting") if
|
||||
* [(4.5.1)](#4.5.1)
|
||||
|
||||
exists(f) is false, or
|
||||
|
||||
* [(4.5.2)](#4.5.2)
|
||||
|
||||
equivalent(from, to) is true, or
|
||||
|
||||
* [(4.5.3)](#4.5.3)
|
||||
|
||||
is_other(f) || is_other(t) is true, or
|
||||
|
||||
* [(4.5.4)](#4.5.4)
|
||||
|
||||
is_directory(f) && is_regular_file(t) is true[.](#4.5.sentence-1)
|
||||
|
||||
- [(4.6)](#4.6)
|
||||
|
||||
Otherwise, if is_symlink(f), then:
|
||||
* [(4.6.1)](#4.6.1)
|
||||
|
||||
If(options & copy_options::skip_symlinks) != copy_options::none then return[.](#4.6.1.sentence-1)
|
||||
|
||||
* [(4.6.2)](#4.6.2)
|
||||
|
||||
Otherwise if!exists(t) && (options & copy_options::copy_symlinks) != copy_options::none then copy_symlink(from, to)[.](#4.6.2.sentence-1)
|
||||
|
||||
* [(4.6.3)](#4.6.3)
|
||||
|
||||
Otherwise report an error as specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.6.3.sentence-1)
|
||||
|
||||
- [(4.7)](#4.7)
|
||||
|
||||
Otherwise, if is_regular_file(f), then:
|
||||
* [(4.7.1)](#4.7.1)
|
||||
|
||||
If (options & copy_options::directories_only) != copy_options::none, then return[.](#4.7.1.sentence-1)
|
||||
|
||||
* [(4.7.2)](#4.7.2)
|
||||
|
||||
Otherwise, if (options & copy_options::create_symlinks) != copy_options::none, then create a symbolic link to the
|
||||
source file[.](#4.7.2.sentence-1)
|
||||
|
||||
* [(4.7.3)](#4.7.3)
|
||||
|
||||
Otherwise, if (options & copy_options::create_hard_links) != copy_options::none,
|
||||
then create a hard link to the source file[.](#4.7.3.sentence-1)
|
||||
|
||||
* [(4.7.4)](#4.7.4)
|
||||
|
||||
Otherwise, if is_directory(t), then copy_file(from, to/from.filename(), options)[.](#4.7.4.sentence-1)
|
||||
|
||||
* [(4.7.5)](#4.7.5)
|
||||
|
||||
Otherwise, copy_file(from, to, options)[.](#4.7.5.sentence-1)
|
||||
|
||||
- [(4.8)](#4.8)
|
||||
|
||||
Otherwise, ifis_directory(f) &&(options & copy_options::create_symlinks) != copy_options::none then report an error with an error_code argument
|
||||
equal to make_error_code(errc::is_a_directory)[.](#4.8.sentence-1)
|
||||
|
||||
- [(4.9)](#4.9)
|
||||
|
||||
Otherwise, ifis_directory(f) &&((options & copy_options::recursive) != copy_options::none || options == copy_options::none) then:
|
||||
* [(4.9.1)](#4.9.1)
|
||||
|
||||
If exists(t) is false, then create_directory(to, from).
|
||||
|
||||
* [(4.9.2)](#4.9.2)
|
||||
|
||||
Then, iterate over the files in from, as if byfor (const directory_entry& x : directory_iterator(from)) copy(x.path(), to/x.path().filename(),
|
||||
options | copy_options::*in-recursive-copy*); where *in-recursive-copy* is a bitmask element of copy_options that is not one of the elements in [[fs.enum.copy.opts]](fs.enum.copy.opts "31.12.8.3 Enum class copy_options").
|
||||
|
||||
- [(4.10)](#4.10)
|
||||
|
||||
Otherwise, for the signature with argument ec, ec.clear()[.](#4.10.sentence-1)
|
||||
|
||||
- [(4.11)](#4.11)
|
||||
|
||||
Otherwise, no effects[.](#4.11.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17381)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17385)
|
||||
|
||||
*Remarks*: For the signature with argument ec, any
|
||||
library functions called by the implementation shall have an error_code argument if applicable[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17390)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
Given this directory structure:
|
||||
|
||||
```
|
||||
/dir1
|
||||
file1
|
||||
file2
|
||||
dir2
|
||||
file3
|
||||
|
||||
```
|
||||
|
||||
Calling copy("/dir1", "/dir3") would result in:
|
||||
|
||||
```
|
||||
/dir1
|
||||
file1
|
||||
file2
|
||||
dir2
|
||||
file3
|
||||
/dir3
|
||||
file1
|
||||
file2
|
||||
|
||||
```
|
||||
|
||||
Alternatively, calling copy("/dir1", "/dir3", copy_options::recursive) would result in:
|
||||
|
||||
```
|
||||
/dir1
|
||||
file1
|
||||
file2
|
||||
dir2
|
||||
file3
|
||||
/dir3
|
||||
file1
|
||||
file2
|
||||
dir2
|
||||
file3
|
||||
|
||||
```
|
||||
|
||||
â *end example*]
|
||||
109
cppdraft/fs/op/copy/file.md
Normal file
109
cppdraft/fs/op/copy/file.md
Normal file
@@ -0,0 +1,109 @@
|
||||
[fs.op.copy.file]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.copy.file)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.copy.file)
|
||||
|
||||
#### 31.12.13.5 Copy file [fs.op.copy.file]
|
||||
|
||||
[ð](#lib:copy_file)
|
||||
|
||||
`bool filesystem::copy_file(const path& from, const path& to);
|
||||
bool filesystem::copy_file(const path& from, const path& to, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17439)
|
||||
|
||||
*Returns*: copy_file(from, to, copy_options::none) or
|
||||
|
||||
copy_file(from, to, copy_options::none, ec), respectively[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17444)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:copy_file_)
|
||||
|
||||
`bool filesystem::copy_file(const path& from, const path& to, copy_options options);
|
||||
bool filesystem::copy_file(const path& from, const path& to, copy_options options,
|
||||
error_code& ec);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17457)
|
||||
|
||||
*Preconditions*: At most one element from each
|
||||
option group ([[fs.enum.copy.opts]](fs.enum.copy.opts "31.12.8.3 Enum class copy_options")) is set
|
||||
in options[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17463)
|
||||
|
||||
*Effects*: As follows:
|
||||
|
||||
- [(4.1)](#4.1)
|
||||
|
||||
Report an error as specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting") if
|
||||
* [(4.1.1)](#4.1.1)
|
||||
|
||||
is_regular_file(from) is false, or
|
||||
|
||||
* [(4.1.2)](#4.1.2)
|
||||
|
||||
exists(to) is true and is_regular_file(to) is false, or
|
||||
|
||||
* [(4.1.3)](#4.1.3)
|
||||
|
||||
exists(to) is true and equivalent(from, to) is true, or
|
||||
|
||||
* [(4.1.4)](#4.1.4)
|
||||
|
||||
exists(to) is true and(options & (copy_options::skip_existing | copy_options::overwrite_existing | copy_options::update_existing)) == copy_options::none
|
||||
|
||||
- [(4.2)](#4.2)
|
||||
|
||||
Otherwise, copy the contents and attributes of the file from resolves to, to the file to resolves to, if
|
||||
* [(4.2.1)](#4.2.1)
|
||||
|
||||
exists(to) is false, or
|
||||
|
||||
* [(4.2.2)](#4.2.2)
|
||||
|
||||
(options & copy_options::overwrite_existing) != copy_options::none, or
|
||||
|
||||
* [(4.2.3)](#4.2.3)
|
||||
|
||||
(options & copy_options::update_existing) != copy_options::none and from is more recent than to, determined as if by use of the last_write_time function ([[fs.op.last.write.time]](fs.op.last.write.time "31.12.13.26 Last write time"))[.](#4.2.sentence-1)
|
||||
|
||||
- [(4.3)](#4.3)
|
||||
|
||||
Otherwise, no effects[.](#4.3.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17495)
|
||||
|
||||
*Returns*: true if the from file
|
||||
was copied, otherwise false[.](#5.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#5.sentence-2)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17501)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17505)
|
||||
|
||||
*Complexity*: At most one direct or indirect invocation of status(to)[.](#7.sentence-1)
|
||||
31
cppdraft/fs/op/copy/symlink.md
Normal file
31
cppdraft/fs/op/copy/symlink.md
Normal file
@@ -0,0 +1,31 @@
|
||||
[fs.op.copy.symlink]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.copy.symlink)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.copy.symlink)
|
||||
|
||||
#### 31.12.13.6 Copy symlink [fs.op.copy.symlink]
|
||||
|
||||
[ð](#lib:copy_symlink)
|
||||
|
||||
`void filesystem::copy_symlink(const path& existing_symlink, const path& new_symlink);
|
||||
void filesystem::copy_symlink(const path& existing_symlink, const path& new_symlink,
|
||||
error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17520)
|
||||
|
||||
*Effects*: Equivalent to*function*(read_symlink(existing_symlink), new_symlink) or
|
||||
|
||||
*function*(read_symlink(existing_symlink, ec), new_symlink, ec), respectively,
|
||||
where in each case *function* is create_symlink or create_directory_symlink as appropriate[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17528)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
64
cppdraft/fs/op/create/dir/symlk.md
Normal file
64
cppdraft/fs/op/create/dir/symlk.md
Normal file
@@ -0,0 +1,64 @@
|
||||
[fs.op.create.dir.symlk]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.create.dir.symlk)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.create.dir.symlk)
|
||||
|
||||
#### 31.12.13.9 Create directory symlink [fs.op.create.dir.symlk]
|
||||
|
||||
[ð](#lib:create_directory_symlink)
|
||||
|
||||
`void filesystem::create_directory_symlink(const path& to, const path& new_symlink);
|
||||
void filesystem::create_directory_symlink(const path& to, const path& new_symlink,
|
||||
error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17636)
|
||||
|
||||
*Effects*: Establishes the postcondition, as if by POSIX [symlink](http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html)[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17640)
|
||||
|
||||
*Postconditions*: new_symlink resolves to a symbolic link file that
|
||||
contains an unspecified representation of to[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17645)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17649)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Some operating systems require symlink creation to
|
||||
identify that the link is to a directory[.](#4.sentence-1)
|
||||
|
||||
Thus, create_symlink (instead of create_directory_symlink)
|
||||
cannot be used reliably to create directory symlinks[.](#4.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17657)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
Some operating systems do not support symbolic links at all or support
|
||||
them only for regular files[.](#5.sentence-1)
|
||||
|
||||
Some file systems (such as the FAT file system) do not
|
||||
support
|
||||
symbolic links regardless of the operating system[.](#5.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
42
cppdraft/fs/op/create/directories.md
Normal file
42
cppdraft/fs/op/create/directories.md
Normal file
@@ -0,0 +1,42 @@
|
||||
[fs.op.create.directories]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.create.directories)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.create.directories)
|
||||
|
||||
#### 31.12.13.7 Create directories [fs.op.create.directories]
|
||||
|
||||
[ð](#lib:create_directories)
|
||||
|
||||
`bool filesystem::create_directories(const path& p);
|
||||
bool filesystem::create_directories(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17543)
|
||||
|
||||
*Effects*: Calls create_directory for each element of p that does not exist[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17548)
|
||||
|
||||
*Returns*: true if a new directory was created
|
||||
for the directory p resolves to,
|
||||
otherwise false[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17554)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17558)
|
||||
|
||||
*Complexity*: O(n) where *n* is the number of elements
|
||||
of p[.](#4.sentence-1)
|
||||
86
cppdraft/fs/op/create/directory.md
Normal file
86
cppdraft/fs/op/create/directory.md
Normal file
@@ -0,0 +1,86 @@
|
||||
[fs.op.create.directory]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.create.directory)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.create.directory)
|
||||
|
||||
#### 31.12.13.8 Create directory [fs.op.create.directory]
|
||||
|
||||
[ð](#lib:create_directory)
|
||||
|
||||
`bool filesystem::create_directory(const path& p);
|
||||
bool filesystem::create_directory(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17574)
|
||||
|
||||
*Effects*: Creates the directory p resolves to,
|
||||
as if by POSIX mkdir with a second argument of static_cast<int>(perms::all)[.](#1.sentence-1)
|
||||
|
||||
If mkdir fails because p resolves to an existing directory,
|
||||
no error is reported[.](#1.sentence-2)
|
||||
|
||||
Otherwise on failure an error is reported[.](#1.sentence-3)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17582)
|
||||
|
||||
*Returns*: true if a new directory was created, otherwise false[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17586)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:create_directory_)
|
||||
|
||||
`bool filesystem::create_directory(const path& p, const path& existing_p);
|
||||
bool filesystem::create_directory(const path& p, const path& existing_p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17598)
|
||||
|
||||
*Effects*: Creates the
|
||||
directory p resolves to, with
|
||||
attributes copied from directory existing_p[.](#4.sentence-1)
|
||||
|
||||
The set of attributes
|
||||
copied is operating system dependent[.](#4.sentence-2)
|
||||
|
||||
If mkdir fails because p resolves to an existing directory,
|
||||
no error is reported[.](#4.sentence-3)
|
||||
|
||||
Otherwise on failure an error is reported[.](#4.sentence-4)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
For POSIX-based operating systems, the
|
||||
attributes are those copied by native API stat(existing_p.c_str(), &attributes_stat) followed by mkdir(p.c_str(), attributes_stat.st_mode)[.](#4.sentence-5)
|
||||
|
||||
For
|
||||
Windows-based operating systems, the attributes are those copied by native
|
||||
API CreateDirectoryExW(existing_p.c_str(), p.c_str(), 0)[.](#4.sentence-6)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17614)
|
||||
|
||||
*Returns*: true if a new directory was created
|
||||
with attributes copied from directory existing_p,
|
||||
otherwise false[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17620)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#6.sentence-1)
|
||||
58
cppdraft/fs/op/create/hard/lk.md
Normal file
58
cppdraft/fs/op/create/hard/lk.md
Normal file
@@ -0,0 +1,58 @@
|
||||
[fs.op.create.hard.lk]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.create.hard.lk)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.create.hard.lk)
|
||||
|
||||
#### 31.12.13.10 Create hard link [fs.op.create.hard.lk]
|
||||
|
||||
[ð](#lib:create_hard_link)
|
||||
|
||||
`void filesystem::create_hard_link(const path& to, const path& new_hard_link);
|
||||
void filesystem::create_hard_link(const path& to, const path& new_hard_link,
|
||||
error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17677)
|
||||
|
||||
*Effects*: Establishes the postcondition, as if by POSIX link[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17681)
|
||||
|
||||
*Postconditions*:
|
||||
|
||||
- [(2.1)](#2.1)
|
||||
|
||||
exists(to) && exists(new_hard_link) && equivalent(to, new_hard_link)
|
||||
|
||||
- [(2.2)](#2.2)
|
||||
|
||||
The contents of the file or directory to resolves to are unchanged[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17689)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17693)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Some operating systems do not support hard links at all or support
|
||||
them only for regular files[.](#4.sentence-1)
|
||||
|
||||
Some file systems (such as the FAT file system)
|
||||
do not support hard links regardless of the operating system[.](#4.sentence-2)
|
||||
|
||||
Some file systems limit the number of links per file[.](#4.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
49
cppdraft/fs/op/create/symlink.md
Normal file
49
cppdraft/fs/op/create/symlink.md
Normal file
@@ -0,0 +1,49 @@
|
||||
[fs.op.create.symlink]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.create.symlink)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.create.symlink)
|
||||
|
||||
#### 31.12.13.11 Create symlink [fs.op.create.symlink]
|
||||
|
||||
[ð](#lib:create_symlink)
|
||||
|
||||
`void filesystem::create_symlink(const path& to, const path& new_symlink);
|
||||
void filesystem::create_symlink(const path& to, const path& new_symlink,
|
||||
error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17712)
|
||||
|
||||
*Effects*: Establishes the postcondition, as if by POSIX [symlink](http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html)[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17716)
|
||||
|
||||
*Postconditions*: new_symlink resolves to a symbolic link file that
|
||||
contains an unspecified representation of to[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17721)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17725)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Some operating systems do not support symbolic links at all or support
|
||||
them only for regular files[.](#4.sentence-1)
|
||||
|
||||
Some file systems (such as the FAT file system) do not
|
||||
support symbolic links regardless of the operating system[.](#4.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
88
cppdraft/fs/op/current/path.md
Normal file
88
cppdraft/fs/op/current/path.md
Normal file
@@ -0,0 +1,88 @@
|
||||
[fs.op.current.path]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.current.path)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.current.path)
|
||||
|
||||
#### 31.12.13.12 Current path [fs.op.current.path]
|
||||
|
||||
[ð](#lib:current_path)
|
||||
|
||||
`path filesystem::current_path();
|
||||
path filesystem::current_path(error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17743)
|
||||
|
||||
*Returns*: The absolute path of the current working directory,
|
||||
whose pathname in the native format is
|
||||
obtained as if by POSIX [getcwd](http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html)[.](#1.sentence-1)
|
||||
|
||||
The signature with argument ec returns path() if an
|
||||
error occurs[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17751)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17755)
|
||||
|
||||
*Remarks*: The current working directory is the directory, associated
|
||||
with the process, that is used as the starting location in pathname resolution
|
||||
for relative paths[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17761)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
The current path as returned by many operating systems is a dangerous
|
||||
global variable and can be changed unexpectedly by third-party or system
|
||||
library functions, or by another thread[.](#4.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:current_path_)
|
||||
|
||||
`void filesystem::current_path(const path& p);
|
||||
void filesystem::current_path(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17776)
|
||||
|
||||
*Effects*: Establishes the postcondition, as if by POSIX [chdir](http://pubs.opengroup.org/onlinepubs/9699919799/functions/chdir.html)[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17780)
|
||||
|
||||
*Postconditions*: equivalent(p, current_path())[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17784)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17788)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
The current path for many operating systems is a dangerous
|
||||
global state and can be changed unexpectedly by third-party or system
|
||||
library functions, or by another thread[.](#8.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
52
cppdraft/fs/op/equivalent.md
Normal file
52
cppdraft/fs/op/equivalent.md
Normal file
@@ -0,0 +1,52 @@
|
||||
[fs.op.equivalent]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.equivalent)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.equivalent)
|
||||
|
||||
#### 31.12.13.13 Equivalent [fs.op.equivalent]
|
||||
|
||||
[ð](#lib:equivalent)
|
||||
|
||||
`bool filesystem::equivalent(const path& p1, const path& p2);
|
||||
bool filesystem::equivalent(const path& p1, const path& p2, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17805)
|
||||
|
||||
Two paths are considered to resolve to the same file system entity if two
|
||||
candidate entities reside on the same device at the same location[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
On POSIX platforms, this is
|
||||
determined as if by the values of the POSIX stat class,
|
||||
obtained as if by stat for the two paths, having equal st_dev values
|
||||
and equal st_ino values[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17815)
|
||||
|
||||
*Returns*: true, if p1 and p2 resolve to the same file
|
||||
system entity, otherwise false[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17821)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17825)
|
||||
|
||||
*Remarks*: !exists(p1) || !exists(p2) is an error[.](#4.sentence-1)
|
||||
51
cppdraft/fs/op/exists.md
Normal file
51
cppdraft/fs/op/exists.md
Normal file
@@ -0,0 +1,51 @@
|
||||
[fs.op.exists]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.exists)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.exists)
|
||||
|
||||
#### 31.12.13.14 Exists [fs.op.exists]
|
||||
|
||||
[ð](#lib:exists)
|
||||
|
||||
`bool filesystem::exists(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17839)
|
||||
|
||||
*Returns*: status_known(s) && s.type() != file_type::not_found[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:exists_)
|
||||
|
||||
`bool filesystem::exists(const path& p);
|
||||
bool filesystem::exists(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17851)
|
||||
|
||||
Let s be a file_status,
|
||||
determined as if by status(p) or status(p, ec), respectively[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17855)
|
||||
|
||||
*Effects*: The signature with argument ec calls ec.clear() if status_known(s)[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17860)
|
||||
|
||||
*Returns*: exists(s)[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17864)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#5.sentence-1)
|
||||
43
cppdraft/fs/op/file/size.md
Normal file
43
cppdraft/fs/op/file/size.md
Normal file
@@ -0,0 +1,43 @@
|
||||
[fs.op.file.size]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.file.size)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.file.size)
|
||||
|
||||
#### 31.12.13.15 File size [fs.op.file.size]
|
||||
|
||||
[ð](#lib:file_size)
|
||||
|
||||
`uintmax_t filesystem::file_size(const path& p);
|
||||
uintmax_t filesystem::file_size(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17879)
|
||||
|
||||
*Effects*: If exists(p) is false, an error is reported ([[fs.err.report]](fs.err.report "31.12.5 Error reporting"))[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17883)
|
||||
|
||||
*Returns*:
|
||||
|
||||
- [(2.1)](#2.1)
|
||||
|
||||
If is_regular_file(p), the size in bytes of the file p resolves to, determined as if by the value of the POSIX stat class member st_size obtained as if by POSIX [stat](http://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html)[.](#2.1.sentence-1)
|
||||
|
||||
- [(2.2)](#2.2)
|
||||
|
||||
Otherwise, the result is implementation-defined[.](#2.2.sentence-1)
|
||||
|
||||
The signature with argument ec returns static_cast<uintmax_t>(-1) if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17896)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
2041
cppdraft/fs/op/funcs.md
Normal file
2041
cppdraft/fs/op/funcs.md
Normal file
File diff suppressed because it is too large
Load Diff
29
cppdraft/fs/op/funcs/general.md
Normal file
29
cppdraft/fs/op/funcs/general.md
Normal file
@@ -0,0 +1,29 @@
|
||||
[fs.op.funcs.general]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.funcs.general)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#general)
|
||||
|
||||
#### 31.12.13.1 General [fs.op.funcs.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17152)
|
||||
|
||||
Filesystem operation functions query or modify files, including directories,
|
||||
in external storage[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17156)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Because hardware failures, network failures, file system races ([[fs.race.behavior]](fs.race.behavior "31.12.2.4 File system race behavior")),
|
||||
and many other kinds of errors occur frequently in file system operations,
|
||||
any filesystem operation function, no matter how apparently innocuous,
|
||||
can encounter an error; see [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
30
cppdraft/fs/op/hard/lk/ct.md
Normal file
30
cppdraft/fs/op/hard/lk/ct.md
Normal file
@@ -0,0 +1,30 @@
|
||||
[fs.op.hard.lk.ct]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.hard.lk.ct)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.hard.lk.ct)
|
||||
|
||||
#### 31.12.13.16 Hard link count [fs.op.hard.lk.ct]
|
||||
|
||||
[ð](#lib:hard_link_count)
|
||||
|
||||
`uintmax_t filesystem::hard_link_count(const path& p);
|
||||
uintmax_t filesystem::hard_link_count(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17911)
|
||||
|
||||
*Returns*: The number of hard links for p[.](#1.sentence-1)
|
||||
|
||||
The signature
|
||||
with argument ec returns static_cast<uintmax_t>(-1) if an error occurs[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17917)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
40
cppdraft/fs/op/is/block/file.md
Normal file
40
cppdraft/fs/op/is/block/file.md
Normal file
@@ -0,0 +1,40 @@
|
||||
[fs.op.is.block.file]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.block.file)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.block.file)
|
||||
|
||||
#### 31.12.13.17 Is block file [fs.op.is.block.file]
|
||||
|
||||
[ð](#lib:is_block_file)
|
||||
|
||||
`bool filesystem::is_block_file(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17931)
|
||||
|
||||
*Returns*: s.type() == file_type::block[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_block_file_)
|
||||
|
||||
`bool filesystem::is_block_file(const path& p);
|
||||
bool filesystem::is_block_file(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17943)
|
||||
|
||||
*Returns*: is_block_file(status(p)) or is_block_file(status(p, ec)), respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17948)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
44
cppdraft/fs/op/is/char/file.md
Normal file
44
cppdraft/fs/op/is/char/file.md
Normal file
@@ -0,0 +1,44 @@
|
||||
[fs.op.is.char.file]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.char.file)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.char.file)
|
||||
|
||||
#### 31.12.13.18 Is character file [fs.op.is.char.file]
|
||||
|
||||
[ð](#lib:is_character_file)
|
||||
|
||||
`bool filesystem::is_character_file(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17962)
|
||||
|
||||
*Returns*: s.type() == file_type::character[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_character_file_)
|
||||
|
||||
`bool filesystem::is_character_file(const path& p);
|
||||
bool filesystem::is_character_file(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17974)
|
||||
|
||||
*Returns*: is_character_file(status(p)) or is_character_file(status(p, ec)),
|
||||
respectively[.](#2.sentence-1)
|
||||
|
||||
|
||||
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17981)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
41
cppdraft/fs/op/is/directory.md
Normal file
41
cppdraft/fs/op/is/directory.md
Normal file
@@ -0,0 +1,41 @@
|
||||
[fs.op.is.directory]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.directory)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.directory)
|
||||
|
||||
#### 31.12.13.19 Is directory [fs.op.is.directory]
|
||||
|
||||
[ð](#lib:is_directory)
|
||||
|
||||
`bool filesystem::is_directory(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17995)
|
||||
|
||||
*Returns*: s.type() == file_type::directory[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_directory_)
|
||||
|
||||
`bool filesystem::is_directory(const path& p);
|
||||
bool filesystem::is_directory(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18007)
|
||||
|
||||
*Returns*: is_directory(status(p)) or is_directory(status(p, ec)),
|
||||
respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18013)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
71
cppdraft/fs/op/is/empty.md
Normal file
71
cppdraft/fs/op/is/empty.md
Normal file
@@ -0,0 +1,71 @@
|
||||
[fs.op.is.empty]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.empty)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.empty)
|
||||
|
||||
#### 31.12.13.20 Is empty [fs.op.is.empty]
|
||||
|
||||
[ð](#lib:is_empty,function)
|
||||
|
||||
`bool filesystem::is_empty(const path& p);
|
||||
bool filesystem::is_empty(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18028)
|
||||
|
||||
*Effects*:
|
||||
|
||||
- [(1.1)](#1.1)
|
||||
|
||||
Determine file_status s,
|
||||
as if by status(p) or status(p, ec), respectively[.](#1.1.sentence-1)
|
||||
|
||||
- [(1.2)](#1.2)
|
||||
|
||||
For the signature with argument ec,
|
||||
return false if an error occurred[.](#1.2.sentence-1)
|
||||
|
||||
- [(1.3)](#1.3)
|
||||
|
||||
Otherwise, if is_directory(s):
|
||||
* [(1.3.1)](#1.3.1)
|
||||
|
||||
Create a variable itr,
|
||||
as if by directory_iterator itr(p) or directory_iterator itr(p, ec), respectively[.](#1.3.1.sentence-1)
|
||||
|
||||
* [(1.3.2)](#1.3.2)
|
||||
|
||||
For the signature with argument ec,
|
||||
return false if an error occurred[.](#1.3.2.sentence-1)
|
||||
|
||||
* [(1.3.3)](#1.3.3)
|
||||
|
||||
Otherwise, return itr == directory_iterator()[.](#1.3.3.sentence-1)
|
||||
|
||||
- [(1.4)](#1.4)
|
||||
|
||||
Otherwise:
|
||||
* [(1.4.1)](#1.4.1)
|
||||
|
||||
Determine uintmax_t sz,
|
||||
as if by file_size(p) or file_size(p, ec), respectively[.](#1.4.1.sentence-1)
|
||||
|
||||
* [(1.4.2)](#1.4.2)
|
||||
|
||||
For the signature with argument ec,
|
||||
return false if an error occurred[.](#1.4.2.sentence-1)
|
||||
|
||||
* [(1.4.3)](#1.4.3)
|
||||
|
||||
Otherwise, return sz == 0[.](#1.4.3.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18055)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
40
cppdraft/fs/op/is/fifo.md
Normal file
40
cppdraft/fs/op/is/fifo.md
Normal file
@@ -0,0 +1,40 @@
|
||||
[fs.op.is.fifo]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.fifo)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.fifo)
|
||||
|
||||
#### 31.12.13.21 Is fifo [fs.op.is.fifo]
|
||||
|
||||
[ð](#lib:is_fifo)
|
||||
|
||||
`bool filesystem::is_fifo(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18069)
|
||||
|
||||
*Returns*: s.type() == file_type::fifo[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_fifo_)
|
||||
|
||||
`bool filesystem::is_fifo(const path& p);
|
||||
bool filesystem::is_fifo(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18082)
|
||||
|
||||
*Returns*: is_fifo(status(p)) or is_fifo(status(p, ec)), respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18087)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
41
cppdraft/fs/op/is/other.md
Normal file
41
cppdraft/fs/op/is/other.md
Normal file
@@ -0,0 +1,41 @@
|
||||
[fs.op.is.other]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.other)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.other)
|
||||
|
||||
#### 31.12.13.22 Is other [fs.op.is.other]
|
||||
|
||||
[ð](#lib:is_other)
|
||||
|
||||
`bool filesystem::is_other(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18101)
|
||||
|
||||
*Returns*: exists(s) && !is_regular_file(s) && !is_directory(s) && !is_symlink(s)[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_other_)
|
||||
|
||||
`bool filesystem::is_other(const path& p);
|
||||
bool filesystem::is_other(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18113)
|
||||
|
||||
*Returns*: is_other(status(p)) or is_other(status(p, ec)),
|
||||
respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18119)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
64
cppdraft/fs/op/is/regular/file.md
Normal file
64
cppdraft/fs/op/is/regular/file.md
Normal file
@@ -0,0 +1,64 @@
|
||||
[fs.op.is.regular.file]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.regular.file)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.regular.file)
|
||||
|
||||
#### 31.12.13.23 Is regular file [fs.op.is.regular.file]
|
||||
|
||||
[ð](#lib:is_regular_file)
|
||||
|
||||
`bool filesystem::is_regular_file(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18133)
|
||||
|
||||
*Returns*: s.type() == file_type::regular[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_regular_file_)
|
||||
|
||||
`bool filesystem::is_regular_file(const path& p);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18144)
|
||||
|
||||
*Returns*: is_regular_file(status(p))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18148)
|
||||
|
||||
*Throws*: filesystem_error if status(p) would throw filesystem_error[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:is_regular_file__)
|
||||
|
||||
`bool filesystem::is_regular_file(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18159)
|
||||
|
||||
*Effects*: Sets ec as if by status(p, ec)[.](#4.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
file_type::none, file_type::not_found and file_type::unknown cases set ec to error values[.](#4.sentence-2)
|
||||
|
||||
To distinguish between cases, call the status function directly[.](#4.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18167)
|
||||
|
||||
*Returns*: is_regular_file(status(p, ec))[.](#5.sentence-1)
|
||||
|
||||
Returns false if an error occurs[.](#5.sentence-2)
|
||||
40
cppdraft/fs/op/is/socket.md
Normal file
40
cppdraft/fs/op/is/socket.md
Normal file
@@ -0,0 +1,40 @@
|
||||
[fs.op.is.socket]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.socket)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.socket)
|
||||
|
||||
#### 31.12.13.24 Is socket [fs.op.is.socket]
|
||||
|
||||
[ð](#lib:is_socket)
|
||||
|
||||
`bool filesystem::is_socket(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18182)
|
||||
|
||||
*Returns*: s.type() == file_type::socket[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_socket_)
|
||||
|
||||
`bool filesystem::is_socket(const path& p);
|
||||
bool filesystem::is_socket(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18194)
|
||||
|
||||
*Returns*: is_socket(status(p)) or is_socket(status(p, ec)), respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18200)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
41
cppdraft/fs/op/is/symlink.md
Normal file
41
cppdraft/fs/op/is/symlink.md
Normal file
@@ -0,0 +1,41 @@
|
||||
[fs.op.is.symlink]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.symlink)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.symlink)
|
||||
|
||||
#### 31.12.13.25 Is symlink [fs.op.is.symlink]
|
||||
|
||||
[ð](#lib:is_symlink)
|
||||
|
||||
`bool filesystem::is_symlink(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18214)
|
||||
|
||||
*Returns*: s.type() == file_type::symlink[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_symlink_)
|
||||
|
||||
`bool filesystem::is_symlink(const path& p);
|
||||
bool filesystem::is_symlink(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18226)
|
||||
|
||||
*Returns*: is_symlink(symlink_status(p)) or is_symlink(symlink_status(p, ec)),
|
||||
respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18232)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
61
cppdraft/fs/op/last/write/time.md
Normal file
61
cppdraft/fs/op/last/write/time.md
Normal file
@@ -0,0 +1,61 @@
|
||||
[fs.op.last.write.time]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.last.write.time)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.last.write.time)
|
||||
|
||||
#### 31.12.13.26 Last write time [fs.op.last.write.time]
|
||||
|
||||
[ð](#lib:last_write_time)
|
||||
|
||||
`file_time_type filesystem::last_write_time(const path& p);
|
||||
file_time_type filesystem::last_write_time(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18247)
|
||||
|
||||
*Returns*: The time of last data modification of p,
|
||||
determined as if by the value of the POSIX stat class member st_mtime obtained as if by POSIX stat[.](#1.sentence-1)
|
||||
|
||||
The signature with argument ec returns file_time_type::min() if an error occurs[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18255)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:last_write_time_)
|
||||
|
||||
`void filesystem::last_write_time(const path& p, file_time_type new_time);
|
||||
void filesystem::last_write_time(const path& p, file_time_type new_time,
|
||||
error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18268)
|
||||
|
||||
*Effects*: Sets the time of last data modification of the file
|
||||
resolved to by p to new_time, as if by POSIX [futimens](http://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html)[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18273)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18277)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
A postcondition of last_write_time(p) == new_time is not specified
|
||||
because it does not necessarily hold for file systems with coarse time granularity[.](#5.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
55
cppdraft/fs/op/permissions.md
Normal file
55
cppdraft/fs/op/permissions.md
Normal file
@@ -0,0 +1,55 @@
|
||||
[fs.op.permissions]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.permissions)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.permissions)
|
||||
|
||||
#### 31.12.13.27 Permissions [fs.op.permissions]
|
||||
|
||||
[ð](#lib:permissions)
|
||||
|
||||
`void filesystem::permissions(const path& p, perms prms, perm_options opts=perm_options::replace);
|
||||
void filesystem::permissions(const path& p, perms prms, error_code& ec) noexcept;
|
||||
void filesystem::permissions(const path& p, perms prms, perm_options opts, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18294)
|
||||
|
||||
*Preconditions*: Exactly one of the perm_options constantsreplace, add, or remove is present in opts[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18299)
|
||||
|
||||
*Effects*: Applies the action specified by opts to the file p resolves to,
|
||||
or to file p itself if p is a symbolic link
|
||||
and perm_options::nofollow is set in opts[.](#2.sentence-1)
|
||||
|
||||
The action is applied as if by POSIX fchmodat[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18307)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Conceptually permissions are viewed as bits, but the actual
|
||||
implementation can use some other mechanism[.](#3.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18313)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18317)
|
||||
|
||||
*Remarks*: The second signature behaves as if it had an additional parameterperm_options opts with an argument of perm_options::replace[.](#5.sentence-1)
|
||||
46
cppdraft/fs/op/proximate.md
Normal file
46
cppdraft/fs/op/proximate.md
Normal file
@@ -0,0 +1,46 @@
|
||||
[fs.op.proximate]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.proximate)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.proximate)
|
||||
|
||||
#### 31.12.13.28 Proximate [fs.op.proximate]
|
||||
|
||||
[ð](#lib:proximate)
|
||||
|
||||
`path filesystem::proximate(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18331)
|
||||
|
||||
*Returns*: proximate(p, current_path(), ec)[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18335)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:proximate_)
|
||||
|
||||
`path filesystem::proximate(const path& p, const path& base = current_path());
|
||||
path filesystem::proximate(const path& p, const path& base, error_code& ec);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18347)
|
||||
|
||||
*Returns*: For the first form:weakly_canonical(p).lexically_proximate(weakly_canonical(base));
|
||||
|
||||
For the second form:weakly_canonical(p, ec).lexically_proximate(weakly_canonical(base, ec)); or path() at the first error occurrence, if any[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18359)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
38
cppdraft/fs/op/read/symlink.md
Normal file
38
cppdraft/fs/op/read/symlink.md
Normal file
@@ -0,0 +1,38 @@
|
||||
[fs.op.read.symlink]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.read.symlink)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.read.symlink)
|
||||
|
||||
#### 31.12.13.29 Read symlink [fs.op.read.symlink]
|
||||
|
||||
[ð](#lib:read_symlink)
|
||||
|
||||
`path filesystem::read_symlink(const path& p);
|
||||
path filesystem::read_symlink(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18373)
|
||||
|
||||
*Returns*: If p resolves to a symbolic
|
||||
link, a path object containing the contents of that symbolic
|
||||
link[.](#1.sentence-1)
|
||||
|
||||
The signature with argument ec returns path() if an error occurs[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18380)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
It is an error if p does not
|
||||
resolve to a symbolic link[.](#2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
46
cppdraft/fs/op/relative.md
Normal file
46
cppdraft/fs/op/relative.md
Normal file
@@ -0,0 +1,46 @@
|
||||
[fs.op.relative]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.relative)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.relative)
|
||||
|
||||
#### 31.12.13.30 Relative [fs.op.relative]
|
||||
|
||||
[ð](#lib:relative)
|
||||
|
||||
`path filesystem::relative(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18397)
|
||||
|
||||
*Returns*: relative(p, current_path(), ec)[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18401)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:relative_)
|
||||
|
||||
`path filesystem::relative(const path& p, const path& base = current_path());
|
||||
path filesystem::relative(const path& p, const path& base, error_code& ec);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18413)
|
||||
|
||||
*Returns*: For the first form:weakly_canonical(p).lexically_relative(weakly_canonical(base));
|
||||
|
||||
For the second form:weakly_canonical(p, ec).lexically_relative(weakly_canonical(base, ec)); or path() at the first error occurrence, if any[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18425)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
53
cppdraft/fs/op/remove.md
Normal file
53
cppdraft/fs/op/remove.md
Normal file
@@ -0,0 +1,53 @@
|
||||
[fs.op.remove]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.remove)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.remove)
|
||||
|
||||
#### 31.12.13.31 Remove [fs.op.remove]
|
||||
|
||||
[ð](#lib:remove,path)
|
||||
|
||||
`bool filesystem::remove(const path& p);
|
||||
bool filesystem::remove(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18439)
|
||||
|
||||
*Effects*: If exists(symlink_status(p, ec)), the file p is
|
||||
removed as if by POSIX remove[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
A symbolic link is itself removed, rather than the file it
|
||||
resolves to[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18448)
|
||||
|
||||
*Postconditions*: exists(symlink_status(p)) is false[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18452)
|
||||
|
||||
*Returns*: true if a file p has been removed and false otherwise[.](#3.sentence-1)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
Absence of a file p is not an error[.](#3.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18459)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
50
cppdraft/fs/op/remove/all.md
Normal file
50
cppdraft/fs/op/remove/all.md
Normal file
@@ -0,0 +1,50 @@
|
||||
[fs.op.remove.all]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.remove.all)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.remove.all)
|
||||
|
||||
#### 31.12.13.32 Remove all [fs.op.remove.all]
|
||||
|
||||
[ð](#lib:remove_all)
|
||||
|
||||
`uintmax_t filesystem::remove_all(const path& p);
|
||||
uintmax_t filesystem::remove_all(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18474)
|
||||
|
||||
*Effects*: Recursively deletes the contents of p if it exists,
|
||||
then deletes file p itself, as if by POSIX remove[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
A symbolic link is itself removed, rather than the file it
|
||||
resolves to[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18483)
|
||||
|
||||
*Postconditions*: exists(symlink_status(p)) is false[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18487)
|
||||
|
||||
*Returns*: The number of files removed[.](#3.sentence-1)
|
||||
|
||||
The signature with argument ec returns static_cast< uintmax_t>(-1) if an error
|
||||
occurs[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18493)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
51
cppdraft/fs/op/rename.md
Normal file
51
cppdraft/fs/op/rename.md
Normal file
@@ -0,0 +1,51 @@
|
||||
[fs.op.rename]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.rename)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.rename)
|
||||
|
||||
#### 31.12.13.33 Rename [fs.op.rename]
|
||||
|
||||
[ð](#lib:rename)
|
||||
|
||||
`void filesystem::rename(const path& old_p, const path& new_p);
|
||||
void filesystem::rename(const path& old_p, const path& new_p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18508)
|
||||
|
||||
*Effects*: Renames old_p to new_p, as if by
|
||||
POSIX rename[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
- [(1.1)](#1.1)
|
||||
|
||||
If old_p and new_p resolve to the same existing file,
|
||||
no action is taken[.](#1.1.sentence-1)
|
||||
|
||||
- [(1.2)](#1.2)
|
||||
|
||||
Otherwise, the rename can include the following effects:
|
||||
* [(1.2.1)](#1.2.1)
|
||||
|
||||
if new_p resolves to an existing non-directory file, new_p is removed; otherwise,
|
||||
|
||||
* [(1.2.2)](#1.2.2)
|
||||
|
||||
if new_p resolves to an existing directory, new_p is removed if empty on POSIX compliant operating systems
|
||||
but might be an error on other operating systems[.](#1.2.sentence-1)
|
||||
|
||||
A symbolic link is itself renamed, rather than the file it resolves to[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18529)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
28
cppdraft/fs/op/resize/file.md
Normal file
28
cppdraft/fs/op/resize/file.md
Normal file
@@ -0,0 +1,28 @@
|
||||
[fs.op.resize.file]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.resize.file)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.resize.file)
|
||||
|
||||
#### 31.12.13.34 Resize file [fs.op.resize.file]
|
||||
|
||||
[ð](#lib:resize_file)
|
||||
|
||||
`void filesystem::resize_file(const path& p, uintmax_t new_size);
|
||||
void filesystem::resize_file(const path& p, uintmax_t new_size, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18544)
|
||||
|
||||
*Effects*: Causes the size that would be returned by file_size(p) to be
|
||||
equal to new_size, as if by POSIX truncate[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18549)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
51
cppdraft/fs/op/space.md
Normal file
51
cppdraft/fs/op/space.md
Normal file
@@ -0,0 +1,51 @@
|
||||
[fs.op.space]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.space)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.space)
|
||||
|
||||
#### 31.12.13.35 Space [fs.op.space]
|
||||
|
||||
[ð](#lib:space)
|
||||
|
||||
`space_info filesystem::space(const path& p);
|
||||
space_info filesystem::space(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18564)
|
||||
|
||||
*Returns*: An object of type space_info[.](#1.sentence-1)
|
||||
|
||||
The value of the space_info object is determined as if by using POSIX statvfs to obtain a POSIX struct statvfs,
|
||||
and then multiplying its f_blocks, f_bfree,
|
||||
and f_bavail members by its f_frsize member,
|
||||
and assigning the results to the capacity, free,
|
||||
and available members respectively[.](#1.sentence-2)
|
||||
|
||||
Any members for which the
|
||||
value cannot be determined shall be set to static_cast<uintmax_t>(-1)[.](#1.sentence-3)
|
||||
|
||||
For the signature with argument ec, all members are set to static_cast<uintmax_t>(-1) if an error occurs[.](#1.sentence-4)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18577)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18581)
|
||||
|
||||
*Remarks*: The value of member space_info::available is operating system dependent[.](#3.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
available might be
|
||||
less than free[.](#3.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
160
cppdraft/fs/op/status.md
Normal file
160
cppdraft/fs/op/status.md
Normal file
@@ -0,0 +1,160 @@
|
||||
[fs.op.status]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.status)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.status)
|
||||
|
||||
#### 31.12.13.36 Status [fs.op.status]
|
||||
|
||||
[ð](#lib:status)
|
||||
|
||||
`file_status filesystem::status(const path& p);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18600)
|
||||
|
||||
*Effects*: As if by:error_code ec;
|
||||
file_status result = status(p, ec);if (result.type() == file_type::none)throw filesystem_error(*implementation-supplied-message*, p, ec);return result;
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18611)
|
||||
|
||||
*Returns*: See above[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18615)
|
||||
|
||||
*Throws*: filesystem_error[.](#3.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
result values of file_status(file_type::not_found) and file_status(file_type::unknown) are not considered failures and do not
|
||||
cause an exception to be thrown[.](#3.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:status_)
|
||||
|
||||
`file_status filesystem::status(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18631)
|
||||
|
||||
*Effects*: If possible, determines the attributes
|
||||
of the file p resolves to, as if by using POSIX stat to obtain a POSIX struct stat[.](#4.sentence-1)
|
||||
|
||||
If, during attribute determination, the underlying file system API reports
|
||||
an error, sets ec to indicate the specific error reported[.](#4.sentence-2)
|
||||
|
||||
Otherwise, ec.clear()[.](#4.sentence-3)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
This allows users to inspect the specifics of underlying
|
||||
API errors even when the value returned by status is not file_status(file_type::none)[.](#4.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18645)
|
||||
|
||||
Let prms denote the result of (m & perms::mask),
|
||||
where m is determined as if by converting the st_mode member
|
||||
of the obtained struct stat to the type perms[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18650)
|
||||
|
||||
*Returns*:
|
||||
|
||||
- [(6.1)](#6.1)
|
||||
|
||||
If ec != error_code():
|
||||
* [(6.1.1)](#6.1.1)
|
||||
|
||||
If the specific error indicates that p cannot be resolved
|
||||
because some element of the path does not exist, returns file_status(file_type::not_found)[.](#6.1.1.sentence-1)
|
||||
|
||||
* [(6.1.2)](#6.1.2)
|
||||
|
||||
Otherwise, if the specific error indicates that p can be resolved
|
||||
but the attributes cannot be determined, returns file_status(file_type::unknown)[.](#6.1.2.sentence-1)
|
||||
|
||||
* [(6.1.3)](#6.1.3)
|
||||
|
||||
Otherwise, returns file_status(file_type::none)[.](#6.1.3.sentence-1)
|
||||
|
||||
[*Note [3](#note-3)*:
|
||||
These semantics distinguish between p being known not to exist, p existing but not being able to determine its attributes,
|
||||
and there being an error that prevents even knowing if p exists[.](#6.1.sentence-2)
|
||||
These
|
||||
distinctions are important to some use cases[.](#6.1.sentence-3)
|
||||
â *end note*]
|
||||
|
||||
- [(6.2)](#6.2)
|
||||
|
||||
Otherwise,
|
||||
* [(6.2.1)](#6.2.1)
|
||||
|
||||
If the attributes indicate a regular file, as if by POSIX S_ISREG,
|
||||
returns file_status(file_type::regular, prms)[.](#6.2.1.sentence-1)
|
||||
[*Note [4](#note-4)*:
|
||||
file_type::regular implies appropriate [<fstream>](fstream.syn#header:%3cfstream%3e "31.10.1 Header <fstream> synopsis [fstream.syn]") operations
|
||||
would succeed, assuming no hardware, permission, access, or file system
|
||||
race errors[.](#6.2.1.sentence-2)
|
||||
Lack of file_type::regular does not necessarily imply [<fstream>](fstream.syn#header:%3cfstream%3e "31.10.1 Header <fstream> synopsis [fstream.syn]") operations would fail on a directory[.](#6.2.1.sentence-3)
|
||||
â *end note*]
|
||||
|
||||
* [(6.2.2)](#6.2.2)
|
||||
|
||||
Otherwise, if the attributes indicate a directory, as if by POSIX S_ISDIR, returns file_status(file_type::directory, prms)[.](#6.2.2.sentence-1)
|
||||
[*Note [5](#note-5)*:
|
||||
file_type::directory implies that calling directory_iterator(p) would succeed[.](#6.2.2.sentence-2)
|
||||
â *end note*]
|
||||
|
||||
* [(6.2.3)](#6.2.3)
|
||||
|
||||
Otherwise, if the attributes indicate a block special file, as if by
|
||||
POSIX S_ISBLK, returns file_status(file_type::block, prms)[.](#6.2.3.sentence-1)
|
||||
|
||||
* [(6.2.4)](#6.2.4)
|
||||
|
||||
Otherwise, if the attributes indicate a character special file, as if
|
||||
by POSIX S_ISCHR, returns file_status(file_type::character, prms)[.](#6.2.4.sentence-1)
|
||||
|
||||
* [(6.2.5)](#6.2.5)
|
||||
|
||||
Otherwise, if the attributes indicate a fifo or pipe file, as if by
|
||||
POSIX S_ISFIFO, returns file_status(file_type::fifo, prms)[.](#6.2.5.sentence-1)
|
||||
|
||||
* [(6.2.6)](#6.2.6)
|
||||
|
||||
Otherwise, if the attributes indicate a socket, as if by POSIX S_ISSOCK, returns file_status(file_type::socket, prms)[.](#6.2.6.sentence-1)
|
||||
|
||||
* [(6.2.7)](#6.2.7)
|
||||
|
||||
Otherwise, if the attributes indicate an implementation-defined
|
||||
file type ([[fs.enum.file.type]](fs.enum.file.type "31.12.8.2 Enum class file_type")),
|
||||
returns file_status(file_type::*A*, prms),
|
||||
where *A* is the constant for the implementation-defined file type[.](#6.2.7.sentence-1)
|
||||
|
||||
* [(6.2.8)](#6.2.8)
|
||||
|
||||
Otherwise, returns file_status(file_type::unknown, prms)[.](#6.2.8.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18703)
|
||||
|
||||
*Remarks*: If a symbolic link is encountered during pathname resolution,
|
||||
pathname resolution continues using the contents of the symbolic link[.](#7.sentence-1)
|
||||
20
cppdraft/fs/op/status/known.md
Normal file
20
cppdraft/fs/op/status/known.md
Normal file
@@ -0,0 +1,20 @@
|
||||
[fs.op.status.known]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.status.known)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.status.known)
|
||||
|
||||
#### 31.12.13.37 Status known [fs.op.status.known]
|
||||
|
||||
[ð](#lib:status_known)
|
||||
|
||||
`bool filesystem::status_known(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18718)
|
||||
|
||||
*Returns*: s.type() != file_type::none[.](#1.sentence-1)
|
||||
53
cppdraft/fs/op/symlink/status.md
Normal file
53
cppdraft/fs/op/symlink/status.md
Normal file
@@ -0,0 +1,53 @@
|
||||
[fs.op.symlink.status]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.symlink.status)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.symlink.status)
|
||||
|
||||
#### 31.12.13.38 Symlink status [fs.op.symlink.status]
|
||||
|
||||
[ð](#lib:symlink_status)
|
||||
|
||||
`file_status filesystem::symlink_status(const path& p);
|
||||
file_status filesystem::symlink_status(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18733)
|
||||
|
||||
*Effects*: Same as status, above,
|
||||
except that the attributes
|
||||
of p are determined as if by using POSIX lstat to obtain a POSIX struct stat[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18740)
|
||||
|
||||
Let prms denote the result of (m & perms::mask),
|
||||
where m is determined as if by converting the st_mode member
|
||||
of the obtained struct stat to the type perms[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18745)
|
||||
|
||||
*Returns*: Same as status, above, except
|
||||
that if the attributes indicate a symbolic link, as if by POSIX S_ISLNK,
|
||||
returns file_status(file_type::symlink, prms)[.](#3.sentence-1)
|
||||
|
||||
The signature with argument ec returns file_status(file_type::none) if an error occurs[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18753)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18757)
|
||||
|
||||
*Remarks*: Pathname resolution terminates if p names a symbolic link[.](#5.sentence-1)
|
||||
58
cppdraft/fs/op/temp/dir/path.md
Normal file
58
cppdraft/fs/op/temp/dir/path.md
Normal file
@@ -0,0 +1,58 @@
|
||||
[fs.op.temp.dir.path]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.temp.dir.path)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.temp.dir.path)
|
||||
|
||||
#### 31.12.13.39 Temporary directory path [fs.op.temp.dir.path]
|
||||
|
||||
[ð](#lib:temp_directory_path)
|
||||
|
||||
`path filesystem::temp_directory_path();
|
||||
path filesystem::temp_directory_path(error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18772)
|
||||
|
||||
Let p be an unspecified directory path suitable for temporary files[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18775)
|
||||
|
||||
*Effects*: If exists(p) is false or is_directory(p) is false, an error is reported ([[fs.err.report]](fs.err.report "31.12.5 Error reporting"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18780)
|
||||
|
||||
*Returns*: The path p[.](#3.sentence-1)
|
||||
|
||||
The signature with argument ec returns path() if an
|
||||
error occurs[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18786)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18790)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
For POSIX-based operating systems, an implementation might
|
||||
return the path
|
||||
supplied by the first environment variable found in the list TMPDIR, TMP, TEMP, TEMPDIR,
|
||||
or if none of these are found, "/tmp"[.](#5.sentence-1)
|
||||
|
||||
For Windows-based operating systems, an implementation might return the path
|
||||
reported by the Windows GetTempPath API function[.](#5.sentence-2)
|
||||
|
||||
â *end example*]
|
||||
49
cppdraft/fs/op/weakly/canonical.md
Normal file
49
cppdraft/fs/op/weakly/canonical.md
Normal file
@@ -0,0 +1,49 @@
|
||||
[fs.op.weakly.canonical]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.weakly.canonical)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.weakly.canonical)
|
||||
|
||||
#### 31.12.13.40 Weakly canonical [fs.op.weakly.canonical]
|
||||
|
||||
[ð](#lib:weakly_canonical)
|
||||
|
||||
`path filesystem::weakly_canonical(const path& p);
|
||||
path filesystem::weakly_canonical(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18811)
|
||||
|
||||
*Effects*: Using status(p) or status(p, ec), respectively,
|
||||
to determine existence,
|
||||
return a path composed by operator/= from the result of calling canonical with a path argument composed of
|
||||
the leading elements of p that exist, if any, followed by
|
||||
the elements of p that do not exist, if any[.](#1.sentence-1)
|
||||
|
||||
For the first form, canonical is called without an error_code argument[.](#1.sentence-2)
|
||||
|
||||
For the second form, canonical is called
|
||||
with ec as an error_code argument, and path() is returned at the first error occurrence, if any[.](#1.sentence-3)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18827)
|
||||
|
||||
*Postconditions*: The returned path is in normal form ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18831)
|
||||
|
||||
*Returns*: p with symlinks resolved and
|
||||
the result normalized ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format"))[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18836)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
Reference in New Issue
Block a user