UNPKG

boost-react-native-bundle

Version:

Boost library as in https://sourceforge.net/projects/boost/files/boost/1.57.0/

933 lines (832 loc) 189 kB
<html> <!-- � Copyright Beman Dawes, 2002, 2006, 2007, 2009, 2010, 2011 --> <!-- Distributed under the Boost Software License, Version 1.0. --> <!-- See http://www.boost.org/LICENSE_1_0.txt --> <!-- generate-section-numbers=false --> <head> <meta http-equiv="Content-Language" content="en-us"> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title> $if $TARGET; == BOOST Filesystem Reference $def WHAT "reference documentation" $def SNIPPET_FILE "boost_snippets.html" $def HEADER "boost/filesystem.hpp" $def NAMESPACE boost $def SUBNAMESPACE filesystem $def NAMESPACE_BEGIN "namespace boost { namespace filesystem {" $def NAMESPACE_END " } // namespace filesystem } // namespace boost" $def CODECVT_ARG "const codecvt_type&amp; cvt" $def CODECVT_ARG2 ", const codecvt_type&amp; cvt" $def CODECVT_DEFAULT "=codecvt()" $else Filesystem Proposal $def WHAT "Clause" $def SNIPPET_FILE "tr2_snippets.html" $def HEADER "filesystem" $def NAMESPACE std $def SUBNAMESPACE filesystem $def NAMESPACE_BEGIN "namespace std { namespace tbd { namespace filesystem { " $def NAMESPACE_END "} } } // namespaces std::tbd::filesystem" $def CODECVT_ARG "" $def CODECVT_ARG2 "" $def CODECVT_DEFAULT "" $endif </title> <style type="text/css"> $include "../../../../doc/src/minimal.css" </style> </head> <body> $snippet frontmatter "$SNIPPET_FILE;" <h2><a name="TOC">Table of Contents</a></h2> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td width="33%" valign="top"><a href="#Introduction">Introduction</a><br> <a href="#Definitions">Definitions</a><br> <a href="#Conformance">Conformance</a><br> <a href="#Header-filesystem-synopsis"> Header <code>&lt;$HEADER;&gt;</code> synopsis</a><br> <a href="#Error-reporting">Error reporting</a><br> <a href="#class-path">Class <code>path</code></a><br> &nbsp;&nbsp;&nbsp; <a href="#path-Conversions"><code>path</code> conversions</a><br> &nbsp;&nbsp;&nbsp; <a href="#path-Conversions-to-native-format"><code>path</code> conversions to native format</a><br> &nbsp;&nbsp;&nbsp; <a href="#path-Conversions-to-generic-format"><code>path</code> conversions to generic format</a><br> &nbsp;&nbsp;&nbsp; <a href="#path-Encoding-conversions"><code>path</code> encoding conversions</a><br> &nbsp;&nbsp;&nbsp; <a href="#path-Requirements"><code>path</code> requirements</a><br> &nbsp;&nbsp;&nbsp; <a href="#path-constructors"><code>path</code> constructors</a><br> &nbsp;&nbsp;&nbsp; <a href="#path-assignments"><code>path</code> assignments</a><br> &nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-appends"><code>path</code> appends</a><br> &nbsp;&nbsp; &nbsp;<a href="#path-concatenation"><code>path</code> concatenation</a><br> &nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-modifiers"><code>path</code> modifiers</a><br> &nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-native-format-observers"><code>path</code> native format observers</a><br> &nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-generic-format-observers"><code>path</code> generic format observers</a><br> &nbsp;&nbsp;&nbsp; <a href="#path-compare"><code>path</code> compare</a><br> &nbsp;&nbsp;&nbsp; <a href="#path-decomposition"><code>path</code> decomposition</a><br> &nbsp;&nbsp;&nbsp; <a href="#path-query"><code>path</code> query</a><br> &nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-iterators"><code>path</code> iterators</a><br> $if $TARGET; == BOOST &nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-deprecated-functions"><code>path</code> deprecated functions</a><br> $endif &nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-non-member-functions"><code>path</code> non-member functions</a><br> &nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-inserter-extractor"><code>path</code> inserters and extractors</a><br> &nbsp;<a href="#Class-filesystem_error">Class <code>filesystem_error</code></a><br> &nbsp;&nbsp;&nbsp; <a href="#filesystem_error-members"><code>filesystem_error</code> constructors</a><br> &nbsp;&nbsp;&nbsp; <code>f</code><a href="#filesystem_error-path1"><code>ilesystem_error</code> path1</a><br> &nbsp;&nbsp;&nbsp; <a href="#filesystem_error-path2"><code>filesystem_error</code> path2</a><br> &nbsp;&nbsp;&nbsp; <a href="#filesystem_error-what"><code>filesystem_error</code><code> </code>what</a></td> <td width="33%" valign="top"> <a href="#Enum-file_type">Enum <code>file_type</code></a><br> <a href="#Enum-perms">Enum <code>perms</code></a><br> <a href="#file_status">Class <code>file_status</code></a><br> &nbsp;&nbsp;&nbsp; <a href="#file_status"> <code>file_status</code></a><a href="#file_status-constructors"> constructors</a><br> &nbsp;&nbsp;&nbsp;&nbsp;<code><a href="#file_status-modifiers">file_status-modifiers</a></code><a href="#directory_entry-observers"> observers</a><br> &nbsp;&nbsp;&nbsp;&nbsp;<code><a href="#file_status-observers">file_status-observers</a></code><a href="#directory_entry-modifiers"> modifiers</a><br> <a href="#Class-directory_entry">Class <code>directory_entry</code></a><br> &nbsp;&nbsp;&nbsp; <a href="#directory_entry-constructors"><code>directory_entry</code> constructors</a><br> &nbsp;&nbsp;&nbsp;&nbsp;<a href="#directory_entry-observers"><code>directory_entry</code> observers</a><br> &nbsp;&nbsp;&nbsp;&nbsp;<a href="#directory_entry-modifiers"><code>directory_entry</code> modifiers</a><br> <a href="#Class-directory_iterator">Class <code>directory_iterator</code></a><br> &nbsp;&nbsp;&nbsp; <a href="#directory_iterator-members"><code>directory_iterator</code> members</a><br> <a href="#Class-recursive_directory_iterator">Class <code>recursive_directory_iterator</code></a><br> <a href="#Operational-functions"> Operational functions</a><br> <code>&nbsp;&nbsp;&nbsp;&nbsp <a href="#absolute">absolute</a><br> &nbsp;&nbsp;&nbsp;&nbsp; <a href="#canonical">canonical</a><br> &nbsp;&nbsp;&nbsp;&nbsp; <a href="#copy">copy</a><br> &nbsp;&nbsp;&nbsp;&nbsp; <a href="#copy_directory">copy_directory</a><br> &nbsp;&nbsp;&nbsp;&nbsp; <a href="#copy_file">copy_file</a><br> &nbsp;&nbsp;&nbsp;&nbsp; <a href="#copy_symlink">copy_symlink</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#create_directories">create_directories</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#create_directory">create_directory</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#create_hard_link">create_hard_link</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#create_symlink">create_symlink</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#current_path">current_path</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#exists">exists</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#equivalent">equivalent</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#file_size">file_size</a><br> &nbsp;&nbsp;&nbsp;&nbsp; <a href="#hard_link_count">hard_link_count</a><br> &nbsp;&nbsp;&nbsp;&nbsp; <a href="#initial_path">initial_path</a><br> &nbsp;&nbsp;&nbsp;&nbsp i<a href="#is_directory">s_directory</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#is_empty">is_empty</a></code></td> <td width="34%" valign="top"> <code>&nbsp;&nbsp;&nbsp;&nbsp <a href="#is_other">is_other</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#is_regular_file">is_regular_file</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#is_symlink">is_symlink</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#last_write_time">last_write_time</a><br> &nbsp;&nbsp;&nbsp;&nbsp; <a href="#permissions">permissions</a><br> &nbsp;&nbsp;&nbsp;&nbsp; <a href="#read_symlink">read_symlink</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#remove">remove</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#remove_all">remove_all</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#rename">rename</a><br> &nbsp;&nbsp;&nbsp;&nbsp; <a href="#resize_file">resize_file</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#space">space</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#status">status</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#status_known">status_known</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#symlink_status">symlink_status</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#system_complete">system_complete</a><br> &nbsp;&nbsp;&nbsp;&nbsp <a href="#temp_directory_path">temp_directory_path</a><br> &nbsp;&nbsp;&nbsp;&nbsp; </code> <code> <a href="#unique_path">unique_path</a></code><br> <a href="#File-streams">File streams</a><br> <a href="#Path-decomposition-table">Path decomposition table</a><br> <a href="#long-path-warning">Warning: Long paths on Windows and the extended-length <b>\\?\ </b>prefix</a><br> <a href="#Acknowledgements">Acknowledgements</a><br> <a href="#References">References</a><br> &nbsp;</td> </tr> </table> $snippet wording_prefix "$SNIPPET_FILE;" <h2><a name="Conformance">Conformance</a> [fs.conformance]</h2> <h3>ISO/IEC 9945 conformance [fs.conform.9945]</h3> <p>Some behavior in this $WHAT; is specified by reference to ISO/IEC 9945. How such behavior is actually implemented is unspecified.</p> <blockquote> <p>[<i>Note:</i> This constitutes an &quot;as if&quot; rule for implementation of operating system dependent behavior. In practice implementations will usually call native operating system API's. <i>--end note</i>]</p> </blockquote> <p>Implementations are encouraged to provide such behavior as it is defined by ISO/IEC 9945. Implementations shall document any behavior that differs from the behavior defined by ISO/IEC 9945. Implementations that do not support exact ISO/IEC 9945 behavior are encouraged to provide behavior as close to ISO/IEC 9945 behavior as is reasonable given the limitations of actual operating systems and file systems. If an implementation cannot provide any reasonable behavior, the implementation shall report an error in an implementation-defined manner.</p> <blockquote> <p>[<i>Note:</i> Such errors might be reported by an #error directive, a <code> static_assert</code>, a <code>filesystem_error</code> exception, a special return value, or some other manner. <i>--end note</i>]</p> </blockquote> <p>Implementations are not required to provide behavior that is not supported by a particular file system.</p> <blockquote> <p>[<i>Example:</i> The <a href="http://en.wikipedia.org/wiki/FAT_filesystem"> FAT file system</a> used by some memory cards, camera memory, and floppy discs does not support hard links, symlinks, and many other features of more capable file systems. Implementations are only required to support the FAT features supported by the host operating system. <i>-- end example</i>]</p> </blockquote> <p>The behavior of functions described in this reference may differ from their specification in the presence of <a href="#Race-condition">file system races</a>. No diagnostic is required.</p> <p>If the possibility of a file system race would make it unreliable for a program to test for a precondition before calling a function described in this $WHAT;, <i> Requires</i> is not specified for the condition. Instead, the condition is specified as a <i>Throws</i> condition.</p> <blockquote> <p>[<i>Note:</i> As a design practice, preconditions are not specified when it is unreasonable for a program to detect them prior to calling the function. <i> -- end note</i>]</p> </blockquote> <h3>Operating system dependent conformance [fs.conform.os]</h3> <p>Some behavior is specified in this $WHAT; as being operating system dependent ([fs.def.osdep]). The operation system an implementation is dependent upon is implementation defined.</p> <p>It is permissible for an implementation to be dependent upon an operating system emulator rather than the actual operating system.</p> <blockquote> <p>[<i>Example:</i> An implementation uses Cygwin, a Linux� API emulator for some Windows� operating system versions. The implementation would define Cygwin as its operating system. Users could refer to the Cygwin documentation to find details of the operating system dependent behavior.&nbsp; <i>--end example</i>]</p> <p><span style="background-color: #E0E0E0"><i>It is user and conformance test detectable that such an implementation is running on Cygwin. Users would be misled and conformance tests would fail if the implementation defined Linux or Windows rather than Cygwin as the operating system, since real behavior is a blend of the two.</i></span> </p> </blockquote> <h2><a name="Definitions">Definitions</a> [fs.definitions]</h2> <p>The following definitions shall apply throughout this $WHAT;:</p> <h3><a name="operating system dependent">operating system dependent</a> behavior [fs.def.osdep]</h3> <p>Behavior that is dependent upon the behavior and characteristics of an operating system. See [fs.conform.os].</p> <h3><a name="file">file</a> [fs.def.file]</h3> <p>An object that can be written to, or read from, or both. A file has certain attributes, including type. File types include regular files and directories. Other types of files, such as symbolic links, may be supported by the implementation.</p> <h3><a name="file-system">file system</a> [fs.def.filesystem]</h3> <p>A collection of files and certain of their attributes.</p> <h3><a name="filename">filename</a> [fs.def.filename]</h3> <p>The name of a file. Filenames <code> &quot;.&quot;</code>&nbsp; and <code>&quot;..&quot;</code>&nbsp; have special meaning. The follow characteristics of filenames are operating system dependent:</p> <ul> <li> <p>The permitted characters. See [<a href="#Operating-system-examples">fs.os.example</a>s].</p> </li> <li> <p>Specific filenames that are not permitted.</p> </li> <li> <p>Additional filenames that have special meaning.</p> </li> <li> <p>Case awareness and sensitivity during path resolution.</p> </li> <li> <p>Special rules that may apply to file types other than regular files, such as directories.</p> </li> </ul> <h3><a name="path">path</a> [fs.def.path]</h3> <p>A sequence of elements that identify the location of a file within a filesystem. The elements are the <i>root-name<sub>opt</sub></i>, <i> root-directory<sub>opt</sub></i>, and an optional sequence of filenames. [<i>Note:</i> A <a href="#Pathname">pathname</a> is the concrete representation of a path. <i>--end note</i>]</p> <h3><a name="Absolute-path">absolute path</a> [fs.def.absolute-path]</h3> <p>A path that unambiguously identifies the location of a file without reference to an additional starting location. The elements of a path that determine if it is absolute are operating system dependent.</p> <h3><a name="Relative-path">relative path</a> [fs.def.relative-path]</h3> <p>A path that is not absolute, and so only unambiguously identifies the location of a file when resolved relative to an implied starting location. The elements of a path that determine if it is relative are operating system dependent.&nbsp; [<i>Note:</i> Paths <code>&quot;.&quot;</code> and <code>&quot;..&quot;</code> are relative paths. <i>--end note</i>]</p> <h3><a name="canonical-path">canonical path</a> [fs.def.cannonical-path]</h3> <p>An absolute path that has no elements that are symbolic links, and no <code>&quot;.&quot;</code> or <code>&quot;..&quot;</code> elements.</p> <h3>pathname [fs.def.pathname]</h3> <p>A character string that represents the name of a path. Pathnames are formatted according to the generic pathname grammar or an operating system dependent native pathname format.</p> <h3>native pathname format [fs.def.native]</h3> <p>The operating system dependent pathname format accepted by the host operating system.</p> <h3><a name="link">link</a> [fs.def.link]</h3> <p>A directory entry object that associates a filename with a file. On some file systems, several directory entries can associate names with the same file.</p> <h3><a name="hard-link">hard link</a> [fs.def.hardlink]</h3> <p>A link to an existing file. Some file systems support multiple hard links to a file. If the last hard link to a file is removed, the file itself is removed.</p> <blockquote> <p>[<i>Note:</i> A hard link can be thought of as a shared-ownership smart pointer to a file.<i> -- end note</i>]<i> </i></p> </blockquote> <h3><a name="symbolic-link">symbolic link</a> [fs.def.symlink]</h3> <p>A type of file with the property that when the file is encountered during pathname resolution, a string stored by the file is used to modify the pathname resolution.</p> <blockquote> <p>[<i>Note:</i> A symbolic link can be thought of as a raw pointer to a file. If the file pointed to does not exist, the symbolic link is said to be a &quot;dangling&quot; symbolic link.<i> -- end note</i>]<i> </i></p> </blockquote> <h3><a name="file-system-race">file system race</a> [fs.def.race]</h3> <p>The condition that occurs when multiple threads, processes, or computers interleave access and modification of the same object within a file system.</p> <h2><a name="Generic-pathname-grammar">Generic pathname format</a> [path.generic]</h2> <p><i>pathname:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root-name<sub>opt</sub> root-directory<sub>opt</sub> relative-path<sub>opt</sub></i></p> <p><i>root-name:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </i>An operating system dependent name that identifies the starting location for absolute paths. </p> <blockquote> <blockquote> <p>[<i>Note:</i> Many operating systems define a name beginning with two <i>directory-separator</i> characters as a <i>root-name</i> that identifies network or other resource locations. Some operating systems define a single letter followed by a colon as a drive specifier - a <i>root-name</i> identifying a specific device such as a disc drive. <i>--end note</i>]</p> </blockquote> </blockquote> <p><i>root-directory:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; directory-separator</i></p> <p><i>relative-path:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filename<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; relative-path directory-separator<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; relative-path directory-separator filename</i></p> <p><i>filename:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </i><code>&quot;.&quot;</code><i><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </i><code> &quot;..&quot;</code></p> <p><i>preferred-separator:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </i>An operating system dependent directory separator character. May be a synonym for <i> <code>&quot;/&quot;</code>.</i></p> <p><i>directory-separator:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <code>&quot;/&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;/&quot;</code> directory-separator<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; preferred-separator<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; preferred-separator directory-separator</i></p> <p>Multiple successive <i>directory-separator</i> characters are considered to be the same as one <i>directory-separator</i> character.</p> <p>The <i>filename</i> <code>&quot;.&quot;</code> is considered to be a reference to the current directory. The <i>filename</i> <code>&quot;..&quot;</code> is considered to be a reference to the parent directory. Specific <i>filenames</i> may have special meanings for a particular operating system.</p> <h2><a name="Operating-system-examples">Operating system dependent examples</a> (Informative) [fs.os.examples]</h2> <p>Certain features are specified in this $WHAT; as being operating system dependent. The following table shows the application of those specifications for operating systems that use the ISO/IEC 9945 or Windows� application program interfaces (APIs).<sup>[footnote1]</sup></p> <table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111"> <tr> <td><b>Feature</b></td> <td><b>Section</b></td> <td><b>ISO/IEC 9945 API</b></td> <td><b>Windows</b>�<b> API</b></td> <td><b>Notes</b></td> </tr> <tr> <td><code>path::value_type</code></td> <td>[<a href="#class-path">class.path</a>]</td> <td><code>char</code></td> <td><code>wchar_t</code></td> <td>&nbsp;</td> </tr> <tr> <td><code>path::preferred_separator</code></td> <td>[<a href="#class-path">class.path</a>]</td> <td><code>'/'</code></td> <td><code>L'\\'</code> (single backslash)</td> <td>&nbsp;</td> </tr> <tr> <td><code>path(&quot;/&quot;).is_absolute()<br> path(&quot;c:/&quot;).is_absolute()</code></td> <td>[<a href="#path-query">path.query</a>]</td> <td><code>true<br> false</code></td> <td><code>false<br> true</code></td> <td>&nbsp;</td> </tr> <tr> <td><code>path</code> argument disambiguation between generic format and native format</td> <td>[<a href="#path-Conversions-to-native-format">path.arg.fmt.cvt</a>]</td> <td>Not required</td> <td>Not required</td> <td>There is no need to distinguish between the generic format and native format for these operating systems.</td> </tr> <tr> <td><code>path</code> argument format conversion</td> <td>[<a href="#path-Conversions-to-native-format">path.arg.fmt.cvt</a>]</td> <td>No conversion performed</td> <td>No conversion performed</td> <td>The generic format is already acceptable to the native API of these operating systems.</td> </tr> <tr> <td valign="top"> <p><code>path(&quot;/cats/jane&quot;).c_str()<br> path(&quot;/cats/jane/&quot;).c_str()</code></td> <td>[<a href="#path-Conversions-to-native-format">path.arg.fmt.cvt</a>]</td> <td valign="top"> <code>&quot;/cats/jane&quot;<br> &quot;/cats/jane/&quot;</code></td> <td valign="top"> <p><code>L&quot;/cats/jane&quot;<br> L&quot;/cats/jane/&quot;</code></td> <td>These operating systems accept the same native separator between directory names and a final file name, so no format conversion is performed. Other operating systems might require conversion.</td> </tr> <tr> <td>Format conversion by <code>path</code> native format observers</td> <td>[<a href="#path-native-format-observers">path.native.obs</a>]</td> <td>No conversion performed</td> <td>No conversion performed</td> <td>For efficiency, <code>path</code> objects are required to store pathnames in the native format regardless of operating system.</td> </tr> <tr> <td> <p>Format conversion by <code>path</code> generic format observers</td> <td>[<a href="#path-generic-format-observers">path.generic.obs</a>]</td> <td>No conversion performed</td> <td>Backslashes converted to slashes</td> <td>&nbsp;</td> </tr> <tr> <td><code>p.make_preferred()</code></td> <td>[<a href="#path-modifiers">fs.path.modifiers</a>]</td> <td>No change</td> <td>Slashes converted to backslashes</td> <td>&nbsp;</td> </tr> <tr> <td>Characters prohibited in filenames</td> <td>[<a href="#filename">fs.def.filename</a>]</td> <td>0x00, <code>'/'</code></td> <td>0x00-0x1F, <code>'&quot;'</code>, <code>'*'</code>,<code>&nbsp;'*'</code>, <code>'&lt;'</code>, <code>'&gt;'</code>, <code>'?'</code>, <code>'\\'</code> (single backslash), <code>'/'</code>, <code>'|'</code></td> <td>Many operating systems prohibit the ASCII control characters (0x00-0x1F) in filenames.</td> </tr> <tr> <td>Initial imbued <code>path</code> locale</td> <td>[<a href="#path-imbued-locale">path.imbued.locale</a>]</td> <td> <code>std::locale(&quot;&quot;)<br> </code><sup>[footnote 2]</sup></td> <td>Implementation supplied locale using <code>MultiByteToWideChar</code> and <code>WideCharToMultiByte</code> with a codepage of <code>CP_ACP</code> if <code>AreFileApisANSI()</code>is true, otherwise codepage <code>CP_OEMCP</code>.<sup>[footnote 3]</sup></td> <td>Apple OS X�:&nbsp; Implementation supplied locale providing UTF-8 <code>codecvt</code> facet.<sup>[footnote 4]</sup></td> </tr> </table> <p><sup>[footnote1]</sup> OS X� and Windows� are examples of commercially available operating systems. This information is given for the convenience of users of this document and does not constitute an endorsement by ISO or IEC of these products.</p> <p><sup>[footnote 2] </sup>Rationale: ISO C specifies <code>std::locale(&quot;&quot;)</code> as &quot;the locale-specific native environment&quot;, while ISO/IEC 9945 says it &quot;Specifies an implementation-defined native environment.&quot;</p> <p><sup>[footnote 3] </sup>Rationale: This is the current behavior of C and C++ standard library functions that perform file operations using narrow character strings to identify paths. Changing this behavior would be surprising and at variance with existing code, particularly where user input is involved.</p> <p><sup>[footnote 4]</sup> Rationale: Vendor's documentation states &quot;All BSD system functions expect their string parameters to be in UTF-8 encoding and nothing else.&quot;</p> <h2><a name="Header-filesystem-synopsis">Header <code>&lt;$HEADER;&gt;</code> synopsis</a> [filesystem.synopsis]</h2> <pre>$NAMESPACE_BEGIN; class <a href="#class-path">path</a>; $if $TARGET; == BOOST bool lexicographical_compare(path::iterator first1, path::iterator last1, path::iterator first2, path::iterator last2); $endif; void swap(path&amp; lhs, path&amp; rhs); std::size_t <a href="#hash_value">hash_value</a>(const path&amp; p); bool operator==(const path&amp; lhs, const path&amp; rhs); bool operator!=(const path&amp; lhs, const path&amp; rhs); bool operator&lt; (const path&amp; lhs, const path&amp; rhs); bool operator&lt;=(const path&amp; lhs, const path&amp; rhs); bool operator&gt; (const path&amp; lhs, const path&amp; rhs); bool operator&gt;=(const path&amp; lhs, const path&amp; rhs); path operator/ (const path&amp; lhs, const path&amp; rhs); std::ostream&amp; operator&lt;&lt;( std::ostream&amp; os, const path&amp; p ); std::wostream&amp; operator&lt;&lt;( std::wostream&amp; os, const path&amp; p ); std::istream&amp; operator&gt;&gt;( std::istream&amp; is, path&amp; p ); std::wistream&amp; operator&gt;&gt;( std::wistream&amp; is, path&amp; p ) class <a href="#Class-filesystem_error">filesystem_error</a>; class <a href="#Class-directory_entry">directory_entry</a>; class <a href="#Class-directory_iterator">directory_iterator</a>; // enable c++11 range-based for statements const directory_iterator&amp; <a href="#directory_iterator-non-member-functions">begin</a>(const directory_iterator&amp; iter); directory_iterator <a href="#directory_iterator-non-member-functions">end</a>(const directory_iterator&amp;); $if $TARGET; == BOOST // enable BOOST_FOREACH directory_iterator&amp; range_begin(directory_iterator&amp; iter); directory_iterator range_begin(const directory_iterator&amp; iter); directory_iterator range_end(const directory_iterator&amp;); $endif class <a href="#Class-recursive_directory_iterator">recursive_directory_iterator</a>; // enable c++11 range-based for statements const recursive_directory_iterator&amp; <a href="#recursive_directory_iterator-non-member-functions">begin</a>(const recursive_directory_iterator&amp; iter); recursive_directory_iterator <a href="#recursive_directory_iterator-non-member-functions">end</a>(const recursive_directory_iterator&amp;); $if $TARGET; == BOOST // enable BOOST_FOREACH recursive_directory_iterator&amp; range_begin(recursive_directory_iterator&amp; iter); recursive_directory_iterator range_begin(const recursive_directory_iterator&amp; iter); recursive_directory_iterator range_end(const recursive_directory_iterator&amp;); $endif enum <a name="file_type" href="#Enum-file_type">file_type</a> { status_error, file_not_found, regular_file, directory_file, symlink_file, block_file, character_file, fifo_file, socket_file, type_unknown }; enum <a href="#Enum-perms">perms</a> { no_perms, owner_read, owner_write, owner_exe, owner_all, group_read, group_write, group_exe, group_all, others_read, others_write, others_exe, others_all, all_all, set_uid_on_exe, set_gid_on_exe, sticky_bit, perms_mask, perms_not_known, add_perms, remove_perms, symlink_perms }; class <a href="#file_status">file_status</a>; struct <a name="space_info">space_info</a> // returned by <a href="#space" style="text-decoration: none">space</a> function { uintmax_t capacity; uintmax_t free; uintmax_t available; // free space available to a non-privileged process }; enum class <a name="copy_option">copy_option</a> { none fail_if_exists = none, overwrite_if_exists }; enum class <a name="symlink_option">symlink_option</a> { none no_recurse = none, recurse }; // <a href="#Operational-functions">operational functions</a> path <a href="#absolute">absolute</a>(const path&amp; p, const path&amp; base=current_path()); path <a href="#canonical">canonical</a>(const path&amp; p, const path&amp; base = current_path()); path <a href="#canonical">canonical</a>(const path&amp; p, system::error_code&amp; ec); path <a href="#canonical">canonical</a>(const path&amp; p, const path&amp; base, system::error_code&amp; ec); void <a href="#copy">copy</a>(const path&amp; from, const path&amp; to); void <a href="#copy">copy</a>(const path&amp; from, const path&amp; to, system::error_code&amp; ec); void <a href="#create_directory">copy_directory</a>(const path&amp; from, const path&amp; to); void <a href="#create_directory">copy_directory</a>(const path&amp; from, const path&amp; to, system::error_code&amp; ec); void <a href="#copy_file">copy_file</a>(const path&amp; from, const path&amp; to); void <a href="#copy_file">copy_file</a>(const path&amp; from, const path&amp; to, system::error_code&amp; ec); void <a href="#copy_file">copy_file</a>(const path&amp; from, const path&amp; to, <a href="#copy_option">copy_option</a> option); void <a href="#copy_file">copy_file</a>(const path&amp; from, const path&amp; to, <a href="#copy_option">copy_option</a> option, system::error_code&amp; ec); void <a href="#copy_symlink">copy_symlink</a>(const path&amp; existing_symlink, const path&amp; new_symlink); void <a href="#copy_symlink">copy_symlink</a>(const path&amp; existing_symlink, const path&amp; new_symlink, system::error_code&amp; ec); bool <a href="#create_directories">create_directories</a>(const path&amp; p); bool <a href="#create_directories">create_directories</a>(const path&amp; p, system::error_code&amp; ec); bool <a href="#create_directory">create_directory</a>(const path&amp; p); bool <a href="#create_directory">create_directory</a>(const path&amp; p, system::error_code&amp; ec); void <a href="#create_directory_symlink">create_directory_symlink</a>(const path&amp; to, const path&amp; new_symlink); void <a href="#create_directory_symlink">create_directory_symlink</a>(const path&amp; to, const path&amp; new_symlink, system::error_code&amp; ec); void <a href="#create_hard_link">create_hard_link</a>(const path&amp; to, const path&amp; new_hard_link); void <a href="#create_hard_link">create_hard_link</a>(const path&amp; to, const path&amp; new_hard_link, system::error_code&amp; ec); void <a href="#create_symlink">create_symlink</a>(const path&amp; to, const path&amp; new_symlink); void <a href="#create_symlink">create_symlink</a>(const path&amp; to, const path&amp; new_symlink, system::error_code&amp; ec); path <a href="#current_path">current_path</a>(); path <a href="#current_path">current_path</a>(system::error_code&amp; ec); void <a href="#current_path">current_path</a>(const path&amp; p); void <a href="#current_path">current_path</a>(const path&amp; p, system::error_code&amp; ec); bool <a href="#exists">exists</a>(file_status s) noexcept; bool <a href="#exists">exists</a>(const path&amp; p); bool <a href="#exists">exists</a>(const path&amp; p, system::error_code&amp; ec) noexcept; bool <a href="#equivalent">equivalent</a>(const path&amp; p1, const path&amp; p2); bool <a href="#equivalent">equivalent</a>(const path&amp; p1, const path&amp; p2, system::error_code&amp; ec); uintmax_t <a href="#file_size">file_size</a>(const path&amp; p); uintmax_t <a href="#file_size">file_size</a>(const path&amp; p, system::error_code&amp; ec); uintmax_t <a href="#hard_link_count">hard_link_count</a>(const path&amp; p); uintmax_t <a href="#hard_link_count">hard_link_count</a>(const path&amp; p, system::error_code&amp; ec); const path&amp; <a href="#initial_path">initial_path</a>(); const path&amp; <a href="#initial_path">initial_path</a>(<code>system::error_code&amp; ec</code>); bool <a href="#is_directory">is_directory</a>(file_status s) noexcept; bool <a href="#is_directory2">is_directory</a>(const path&amp; p); bool <a href="#is_directory2">is_directory</a>(const path&amp; p, system::error_code&amp; ec) noexcept; bool <a href="#is_empty">is_empty</a>(const path&amp; p); bool <a href="#is_empty">is_empty</a>(const path&amp; p, system::error_code&amp; ec); bool <a href="#is_other">is_other</a>(file_status s) noexcept; bool <a href="#is_other2">is_other</a>(const path&amp; p,); bool <a href="#is_other2">is_other</a>(const path&amp; p, system::error_code&amp; ec) noexcept; bool <a href="#is_regular_file">is_regular_file</a>(file_status s) noexcept; bool i<a href="#is_regular_file2">s_regular_file</a>(const path&amp; p); bool i<a href="#is_regular_file2">s_regular_file</a>(const path&amp; p, system::error_code&amp; ec) noexcept; bool <a href="#is_symlink">is_symlink</a>(file_status s noexcept); bool <a href="#is_symlink2">is_symlink</a>(const path&amp; p); bool <a href="#is_symlink2">is_symlink</a>(const path&amp; p, system::error_code&amp; ec) noexcept; std::time_t <a href="#last_write_time">last_write_time</a>(const path&amp; p); std::time_t <a href="#last_write_time">last_write_time</a>(const path&amp; p, system::error_code&amp; ec); void <a href="#last_write_time2">last_write_time</a>(const path&amp; p, const std::time_t new_time); void <a href="#last_write_time2">last_write_time</a>(const path&amp; p, const std::time_t new_time, system::error_code&amp; ec); path <a href="#read_symlink">read_symlink</a>(const path&amp; p); path <a href="#read_symlink">read_symlink</a>(const path&amp; p, system::error_code&amp; ec); bool <a href="#remove">remove</a>(const path&amp; p); bool <a href="#remove">remove</a>(const path&amp; p, system::error_code&amp; ec); uintmax_t <a href="#remove_all">remove_all</a>(const path&amp; p); uintmax_t <a href="#remove_all">remove_all</a>(const path&amp; p, system::error_code&amp; ec); void <a href="#rename">rename</a>(const path&amp; from, const path&amp; to); void <a href="#rename">rename</a>(const path&amp; from, const path&amp; to, system::error_code&amp; ec); void <a href="#resize_file">resize_file</a>(const path&amp; p, uintmax_t size); void <a href="#resize_file2">resize_file</a>(const path&amp; p, uintmax_t size, system::error_code&amp; ec); <a href="#space_info">space_info</a> <a href="#space">space</a>(const path&amp; p); <a href="#space_info">space_info</a> <a href="#space">space</a>(const path&amp; p, system::error_code&amp; ec); <a href="#file_status">file_status</a> <a href="#status">status</a>(const path&amp; p); <a href="#file_status">file_status</a> <a href="#status">status</a>(const path&amp; p, system::error_code&amp; ec) noexcept; bool <a href="#status_known">status_known</a>(file_status s) noexcept; <a href="#file_status">file_status</a> <a href="#symlink_status">symlink_status</a>(const path&amp; p); <a href="#file_status">file_status</a> <a href="#symlink_status">symlink_status</a>(const path&amp; p, system::error_code&amp; ec) noexcept; path <a href="#system_complete">system_complete</a>(const path&amp; p); path <a href="#system_complete">system_complete</a>(const path&amp; p, system::error_code&amp; ec); path <a href="#temp_directory_path">temp_directory_path</a>(); path <a href="#temp_directory_path">temp_directory_path</a>(system::error_code&amp; ec); path <a href="#unique_path">unique_path</a>(const path&amp; model=&quot;%%%%-%%%%-%%%%-%%%%&quot;); path <a href="#unique_path">unique_path</a>(const path&amp; model, system::error_code&amp; ec); $NAMESPACE_END;</pre> <h2><a name="Error-reporting">Error reporting</a> [fs.err.report]</h2> <p>Filesystem library functions often provide two overloads, one that throws an exception to report file system errors, and another that sets an <code>error_code</code>.</p> <blockquote> <p>[<i>Note:</i> This supports two common use cases:</p> <ul> <li>Uses where file system errors are truly exceptional and indicate a serious failure. Throwing an exception is the most appropriate response. This is the preferred default for most everyday programming.<br> &nbsp;</li> <li>Uses where file system system errors are routine and do not necessarily represent failure. Returning an error code is the most appropriate response. This allows application specific error handling, including simply ignoring the error.</li> </ul> <p><i>--end note</i>]</p> </blockquote> <p>Functions <b>not</b> having an argument of type <code>system::error_code&amp;</code> report errors as follows, unless otherwise specified:</p> <ul> <li>When a call by the implementation to an operating system or other underlying API results in an error that prevents the function from meeting its specifications, an exception of type <code>filesystem_error</code> is thrown.<br> &nbsp;</li> <li>Failure to allocate storage is reported by throwing an exception as described in the C++ standard, 17.6.4.10 [res.on.exception.handling].<br> &nbsp;</li> <li>Destructors throw nothing.</li> </ul> <p>Functions having an argument of type <code>system::error_code&amp;</code> report errors as follows, unless otherwise specified:</p> <ul> <li>If a call by the implementation to an operating system or other underlying API results in an error that prevents the function from meeting its specifications, the <code>system::error_code&amp;</code> argument is set as appropriate appropriate for the specific error. Otherwise, <code>clear()</code> is called on the <code>system::error_code&amp;</code> argument.<br> &nbsp;</li> <li>Failure to allocate storage is reported by throwing an exception as described in the C++ standard, 17.6.4.10 [res.on.exception.handling].</li> </ul> <h2><a name="class-path">Class <code>path</code> [class.path]</a></h2> <p>An object of class <code>path</code> represents a <a href="#Path">path</a>, and contains a <a href="#Pathname">pathname</a> Such an object is concerned only with the lexical and syntactic aspects of a path. The path does not necessarily exist in external storage, and the pathname is not necessarily valid for the current operating system or for a particular file system.</p> <pre>$NAMESPACE_BEGIN; class path { public: typedef <b><i><a href="#value_type">see below</a></i></b> value_type; typedef std::basic_string&lt;value_type&gt; string_type; typedef std::codecvt&lt;wchar_t, char, std::mbstate_t&gt; codecvt_type; constexpr value_type preferred_separator; // <a href="#path-constructors">constructors</a> and destructor path(); path(const path&amp; p); path(path&amp;&amp; p) noexcept; template &lt;class <a href="#Source">Source</a>&gt; path(Source const&amp; source$CODECVT_ARG2;$CODECVT_DEFAULT;); template &lt;class <a href="#InputIterator">InputIterator</a>&gt; path(InputIterator begin, InputIterator end$CODECVT_ARG2;$CODECVT_DEFAULT;); ~path(); // <a href="#path-assignments">assignments</a> path&amp; operator=(const path&amp; p); path&amp; operator=(path&amp;&amp; p) noexcept; template &lt;class <a href="#Source">Source</a>&gt; path&amp; operator=(Source const&amp; source); $if $TARGET; == BOOST template &lt;class <a href="#Source">Source</a>&gt; path&amp; assign(Source const&amp; source$CODECVT_ARG2;) $endif; template &lt;class <a href="#InputIterator">InputIterator</a>&gt; path&amp; assign(InputIterator begin, InputIterator end$CODECVT_ARG2;$CODECVT_DEFAULT;); // <a href="#path-appends">appends</a> path&amp; operator/=(const path&amp; p); template &lt;class <a href="#Source">Source</a>&gt; path&amp; operator/=(Source const&amp; source); $if $TARGET; == BOOST template &lt;class <a href="#Source">Source</a>&gt; path&amp; append(Source const&amp; source$CODECVT_ARG2;); $endif; template &lt;class <a href="#InputIterator">InputIterator</a>&gt; path&amp; append(InputIterator begin, InputIterator end$CODECVT_ARG2;$CODECVT_DEFAULT;); // <a href="#path-concatenation">concatenation</a> path&amp; operator+=(const path&amp; x); path&amp; operator+=(const string_type&amp; x); path&amp; operator+=(const value_type* x); path&amp; operator+=(value_type x); template &lt;class Source&gt; path&amp; operator+=(Source const&amp; x); template &lt;class CharT&gt; path&amp; operator+=(CharT x); $if $TARGET; == BOOST template &lt;class Source&gt; path&amp; concat(Source const&amp; x$CODECVT_ARG2;); $endif; template &lt;class InputIterator&gt; path&amp; concat(InputIterator begin, InputIterator end); template &lt;class InputIterator&gt; path&amp; concat(InputIterator begin, InputIterator end$CODECVT_ARG2;); // <a href="#path-modifiers">modifiers</a> void <a href="#path-clear">clear</a>(); path&amp; <a href="#path-make_preferred">make_preferred</a>(); path&amp; <a href="#path-remove_filename">remove_filename</a>(); path&amp; <a href="#path-replace_extension">replace_extension</a>(const path&amp; new_extension = path()); void <a href="#path-swap">swap</a>(path&amp; rhs); // <a href="#path-native-format-observers">native format observers</a> const string_type&amp; <a href="#native">native</a>() const noexcept; // native format, encoding const value_type* <a href="#c_str">c_str</a>() const noexcept; // native().c_str() template &lt;class String&gt; String <a href="#string-template">string</a>($CODECVT_ARG;$CODECVT_DEFAULT;) const; // native format string <a href="#string">string</a>($CODECVT_ARG;$CODECVT_DEFAULT;) const; // native format wstring <a href="#wstring">wstring</a>($CODECVT_ARG;$CODECVT_DEFAULT;) const; // native format u16string <a href="#u16string">u16string</a>() const; // native format u32string <a href="#u32wstring">u32string</a>() const; // native format // <a href="#path-generic-format-observers">generic format observers</a> template &lt;class String&gt; String <a href="#generic_string-template">generic_string</a>() const; string <a href="#generic_string">generic_string</a>($CODECVT_ARG;$CODECVT_DEFAULT;) const; // generic format wstring <a href="#generic_wstring">generic_wstring</a>($CODECVT_ARG;$CODECVT_DEFAULT;) const; // generic format u16string <a href="#generic_u16string">generic_u16string</a>() const; // generic format u32string <a href="#generic_u32wstring">generic_u32string</a>() const; // generic format // <a href="#path-compare">compare</a> int <a href="#path-compare">compare</a>(const path&amp; p) const noexcept; int <a href="#path-compare">compare</a>(const std::string&amp; s) const; int <a href="#path-compare">compare</a>(const value_type* s) const; // <a href="#path-decomposition">decomposition</a> path <a href="#path-root_name">root_name</a>() const; path <a href="#path-root_directory">root_directory</a>() const; path <a href="#path-root_path">root_path</a>() const; path <a href="#path-relative_path">relative_path</a>() const; path <a href="#path-parent_path">parent_path</a>() const; path <a href="#path-filename">filename</a>() const; path <a href="#path-stem">stem</a>() const; path <a href="#path-extension">extension</a>() const; // <a href="#path-query">query</a> bool <a href="#path-query">empty</a>() const; bool <a href="#path-has_root_name">has_root_name</a>() const; bool <a href="#path-has_root_directory">has_root_directory</a>() const; bool <a href="#path-has_root_path">has_root_path</a>() const; bool <a href="#path-has_relative_path">has_relative_path</a>() const; bool <a href="#path-has_parent_path">has_parent_path</a>() const; bool <a href="#path-has_filename">has_filename</a>() const; bool <a href="#path-has_stem">has_stem</a>() const; bool <a href="#path-has_extension">has_extension</a>() const; bool <a href="#path-is_absolute">is_absolute</a>() const; bool <a href="#path-is_relative">is_relative</a>() const; // <a href="#path-iterators">iterators</a> class iterator; typedef iterator const_iterator; iterator begin() const; iterator end() const; // <a href="#path-imbued-locale">imbued locale</a> static std::locale <a href="#path-imbue">imbue</a>(const std::locale&amp; loc); static const codecvt_type &amp; <a href="#path-codecvt">codecvt</a>(); private: string_type pathname; // <b><i>exposition only</i></b> }; $NAMESPACE_END;</pre> <p><code><a name="value_type">value_type</a></code> is a <code>typedef</code> for the character type used by the operating system to represent pathnames.</p> $if $TARGET; == BOOST <h3><a name="path-Usage"><code>path</code> Usage concerns</a> [path.usage]</h3> <h4>Multithreading concerns</h4> <p>Filesystem library functions are not protected against data races. [Modifying an object of a Filesystem library type that is shared between threads risks undefined behavior unless objects of that type are explicitly specified as being sharable without data races or the user supplies a locking mechanism. <i>�end note</i>] [<i>Note:</i> Thus the Filesystem library behaves as if it were part of the standard library, and C++ standard 17.6.4.10 <i>Shared objects and the library</i> [res.on.objects] would thus apply.&nbsp; <i>�end note</i>]</p> <h4>Windows concerns</h4> <p>Visual C++ at least through version 2012 does not employ C++11-style static initialization locks, so the initialization of <code>path::codecvt()</code> can race, either with itself or <code>path::imbue::()</code> if they are called from a different thread. A workaround is to call:</p> <blockquote> <p><code>path::codecvt();&nbsp; // ensure VC++ does not race during initialization.</code></p> </blockquote> <p>in the main thread before launching any additional threads. [<i>Note:</i> The obvious fix of the Filesystem implementation doing the locking d