blob: c70e19fb6422755deb64bcf2942e0e1b129c6b3f [file] [log] [blame]
<html>
<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>Filesystem Reference
</title>
<link rel="stylesheet" type="text/css" href="../../../../doc/src/minimal.css">
</head>
<body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td width="277">
<a href="../../../../index.htm">
<img src="../../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="300" height="86" border="0"></a></td>
<td align="middle">
<font size="7">Filesystem Library<br>
</font>
<font size="6">Version 3</font></td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
<td><a href="../../../../index.htm">Boost Home</a> &nbsp;&nbsp;
<a href="index.htm">Library Home</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
</td>
</td>
</tr>
</table>
<h1>Reference Documentation</h1>
<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 &lt;filesystem&gt; synopsis</a><br>
<a href="#Error-reporting">Error reporting</a><br>
<a href="#class-path">Class path</a><br>
&nbsp;&nbsp;&nbsp; <a href="#path-constructors">path constructors</a><br>
&nbsp;&nbsp;&nbsp; <a href="#path-assignments">path assignments</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-appends">path appends</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-modifiers">path modifiers</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-native-format-observers">path native
format observers</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-generic-format-observers">path generic
format observers</a><br>
&nbsp;&nbsp;&nbsp; <a href="#path-decomposition">path decomposition</a><br>
&nbsp;&nbsp;&nbsp; <a href="#path-query">path query</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-iterators">path iterators</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-deprecated-functions">path deprecated functions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-non-member-functions">path non-member functions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#path-inserter-extractor">path inserters and extractor</a>s<span style="background-color: #FFFFFF"><br>
</span> &nbsp;<a href="#Class-filesystem_error">Class filesystem_error</a><br>
&nbsp;&nbsp;&nbsp; <a href="#filesystem_error-members">filesystem_error
constructors</a><br>
&nbsp;&nbsp;&nbsp; f<a href="#filesystem_error-path1">ilesystem_error path1</a><br>
&nbsp;&nbsp;&nbsp; <a href="#filesystem_error-path2">filesystem_error path2</a><br>
&nbsp;&nbsp;&nbsp; <a href="#filesystem_error-what">filesystem_error what</a><br>
<a href="#Class-directory_entry">Class directory_entry</a><br>
&nbsp;&nbsp;&nbsp;
<a href="#directory_entry-constructors">directory_entry constructors</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#directory_entry-modifiers">directory_entry modifiers</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#directory_entry-observers">directory_entry observers</a><br>
<a href="#Class-directory_iterator">Class directory_iterator</a><br>
&nbsp;&nbsp;&nbsp; <a href="#directory_iterator-members">directory_iterator
members</a><br>
<a href="#Class-recursive_directory_iterator">Class recursive_directory_iterator</a><br>
<a href="#file_status">Class
file_status</a><br>
&nbsp;</td>
<td width="33%" valign="top">
<a href="#Operational-functions">
Operational functions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp <a href="#absolute">absolute</a><br>
&nbsp;&nbsp;&nbsp;&nbsp; <a href="#copy_file">copy_file</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 i<a href="#is_directory">s_directory</a><br>
&nbsp;&nbsp;&nbsp;&nbsp <a href="#is_empty">is_empty</a><br>
&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="#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="#unique_path">unique_path</a></td>
<td width="34%" valign="top">
<a href="#File-streams">File streams</a><br>
<a href="#Path-decomposition-table">Path decomposition table</a><br>
<a href="#Acknowledgements">Acknowledgements</a><br>
<a href="#References">References</a><br>
&nbsp;</td>
</tr>
</table>
<h2><a name="Introduction">Introduction</a></h2>
<p>This reference documentation describes components that C++ programs may use
to perform operations involving file systems, including paths, regular files,
and directories.</p>
<h2><a name="Definitions">Definitions</a></h2>
<p>The following definitions shall apply throughout this reference documentation:</p>
<p><i><b><a name="File">File</a>:</b> </i>An object that can be written to, or read from, or both. A file
has certain attributes, including type. Common types of files include regular files
and directories. Other types of files, such as symbolic links, may be supported by the
implementation.</p>
<p><b><i><a name="File-system">File system</a>:</i></b> A collection of files and certain of their attributes.</p>
<p><b><i><a name="Filename">Filename</a>:</i></b> The name of a file. Slash and 0
characters are not permitted. Implementations may define additional
characters or specific names that are not permitted. Filenames <code>.</code>&nbsp;
and <code>..</code>&nbsp; have special meaning. Implementations may define
additional filenames that have special meaning.</p>
<blockquote>
<p><i>[Note:</i> Most operating systems prohibit the ANSI control characters
(0x00-0x31) in filenames.</p>
<p>Windows prohibits the characters 0x00-0x31, <code>&quot;</code>,<code>
*</code>,<code>&nbsp;:</code>,<code> &lt;</code>,<code> &gt;</code>,<code>&nbsp;?</code>,<code>
\</code>,<code> /</code>, and<code> |</code>&nbsp;<i>--end note]</i></p>
</blockquote>
<p><b><i><a name="Path">Path</a>:</i></b> A sequence of elements that identify
a location 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>
<p><b><i><a name="Absolute-path">Absolute path</a>:</i></b> A path that uniquely
identifies a file. The format is implementation defined. </p>
<blockquote>
<p><i>[Note:</i> For POSIX-like implementations, including<b> </b>Unix
variants, Linux, and Mac OS X, only paths
that begin with a slash are absolute paths.</p>
<p>For Windows-like implementations, including <a href="http://www.cygwin.com/">
Cygwin</a> and
<a href="http://www.mingw.org/">MinGW</a>, only paths that begin with a drive
specifier followed by a slash, or begin with two slashes, are absolute paths.&nbsp;<i>--end
note]</i></p>
</blockquote>
<p><b><a name="Relative-path">Relative path</a>:</b> A path that uniquely
identifies a file only when considered relative to some other path. [<i>Note:</i>
Paths &quot;.&quot; and &quot;..&quot; are considered to be relative paths. <i>--end note</i>]</p>
<p><i><b><a name="Pathname">Pathname</a>:</b> </i>A character string that represents a
path. Pathnames are formatted according to the generic pathname format or the
native pathname format.</p>
<p><b><i><a name="generic-pathname-format">Generic pathname format:</a></i></b></p>
<blockquote>
<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;
implementation-defined</i></p>
<blockquote>
<blockquote>
<p>[<i>Note:</i> Most POSIX and Windows based operating system define a name
beginning with two slashes (or backslashes, for Windows) as a root-name
identifying network locations. Windows defines a single letter followed by a
<code>&quot;:&quot;</code> as a root-name identifying 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>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</i></p>
<p>Multiple successive <i>directory-separator</i> characters are considered to
be the same as one <i>directory-separator</i> character. 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 current
directory. Specific <i>filenames</i> may have special meaning for a particular
operating system.</p>
</blockquote>
<p><b><i><a name="native-pathname-format">Native pathname format:</a></i></b>&nbsp;
An implementation defined format. [<i>Note:</i> For POSIX-like operating
systems, the native format is the same as the generic format. For Windows, the
native format is similar to the generic format, but the directory-separator
characters can be either slashes or backslashes. <i>--end note</i>]</p>
<p><i><b><a name="Link">Link</a>:</b> </i>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>
<p><b><i><a name="Hard-link">Hard link</a>:</i></b> 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>
<p><i><a name="Symbolic-link">S<b>ymbolic link</b></a><b>:</b> </i>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>
<p><b><i><a name="Race-condition">Race condition</a>:</i></b> The condition that occurs
when multiple threads, processes, or computers interleave access and
modification of
the same object within a file system.</p>
<p><b><i><a name="Dot">Dot</a>, Dot Dot:</i></b> Synonyms for the filenames <code>&quot;.&quot;</code>
and <code>&quot;..&quot;</code>, respectively. The dot filename names the current
directory. The dot dot filename names the parent directory.</p>
<h2><a name="Conformance">Conformance</a></h2>
<p>Behavior is sometimes specified by reference to ISO/IEC 9945:2003, <i>
<a href="http://www.unix.org/single_unix_specification/">POSIX</a></i>. 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. Presumably implementations will usually call native
operating system API's. <i>--end note</i>]</p>
</blockquote>
<p>Implementations are encouraged, but not required, to support such behavior
as it is defined by <i>POSIX</i>. Implementations shall document any
behavior that differs from the <i>POSIX</i> defined behavior. Implementations that do not support exact <i>POSIX</i> behavior are
encouraged to provide behavior as close to <i>POSIX</i> 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>Specific operating systems such as <i>OpenMVS</i>,
<i>UNIX</i>, and <i>Windows</i> are mentioned only for purposes of illustration or to
give guidance to implementers. No slight to other operating systems is implied
or intended.</p>
<p>The <i>Effects</i> and <i>Postconditions</i> of functions described in this
reference
may not be achieved in
the presence of <a href="#Race-condition">race conditions</a>. No diagnostic is required.</p>
<p>If the possibility of race conditions would make it unreliable for a program to
test for a precondition before calling a function described in this clause, <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>
<h2><a name="Header-filesystem-synopsis">Header <code>&lt;boost/filesystem&gt;</code> synopsis</a></h2>
<pre> namespace boost
{
namespace filesystem
{
class <a href="#class-path">path</a>;
void swap(path&amp; lhs, path&amp; rhs);
bool lexicographical_compare(path::iterator first1, path::iterator last1,
path::iterator first2, path::iterator last2);
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 )
<span style="background-color: #FFFFFF">class <a href="#Class-filesystem_error">filesystem_error</a>;</span><span style="background-color: #FFFF00">
</span>
<span style="background-color: #FFFFFF">class <a href="#Class-directory_entry">directory_entry</a>;
</span> class <a href="#Class-directory_iterator">directory_iterator</a>;
class <a href="#Class-recursive_directory_iterator">recursive_directory_iterator</a>;
enum <a name="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
};
class <a href="#file_status">file_status</a>;
<span style="background-color: #FFFFFF">struct <a name="space_info">space_info</a> // returned by </span><a href="#space" style="text-decoration: none"><span style="background-color: #FFFFFF">space</span></a><span style="background-color: #FFFFFF"> function
{
uintmax_t capacity;
uintmax_t free;
uintmax_t available; // free space available to a non-privileged process
};
BOOST_SCOPED_ENUM_START(<a name="copy_option">copy_option</a>)
{
fail_if_exists,
overwrite_if_exists
};
BOOST_SCOPED_ENUM_END
// <a href="#Operational-functions">operational functions</a>
</span> path <a href="#absolute">absolute</a>(const path&amp; p, const path&amp; base=current_path());
void copy(const path&amp; from, const path&amp; to);
void copy(const path&amp; from, const path&amp; to, system::error_code&amp; ec);
void copy_directory(const path&amp; from, const path&amp; to);
void copy_directory(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, BOOST_SCOPED_ENUM(<a href="#copy_option">copy_option</a>) option);
void <a href="#copy_file">copy_file</a>(const path&amp; from, const path&amp; to, BOOST_SCOPED_ENUM(<a href="#copy_option">copy_option</a>) option,
system::error_code&amp; ec);
void copy_symlink(const path&amp; existing_symlink, const path&amp; new_symlink);
void copy_symlink(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);
<span style="background-color: #FFFFFF"> void create_directory_symlink(const path&amp; to, const path&amp; </span>new_symlink<span style="background-color: #FFFFFF">);
void create_directory_symlink(const path&amp; to, const path&amp; </span>new_symlink, system::error_code&amp; ec<span style="background-color: #FFFFFF">);
</span>
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);
<span style="background-color: #FFFFFF"> void <a href="#create_symlink">create_symlink</a>(const path&amp; to, const path&amp; </span>new_symlink<span style="background-color: #FFFFFF">);
void <a href="#create_symlink">create_symlink</a>(const path&amp; to, const path&amp; </span>new_symlink, system::error_code&amp; ec<span style="background-color: #FFFFFF">);
</span> 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);
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);
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);
<span style="background-color: #FFFFFF; ">uintmax_t</span> <a href="#file_size">file_size</a>(const path&amp; p);
<span style="background-color: #FFFFFF; ">uintmax_t</span> <a href="#file_size">file_size</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<pre> uintmax_t hard_link_count(const path&amp; p);
uintmax_t hard_link_count(const path&amp; p, system::error_code&amp; ec);
bool <a href="#is_directory">is_directory</a>(file_status s);
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);
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);
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);
bool <a href="#is_regular_file">is_regular_file</a>(file_status s);
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);
bool <a href="#is_symlink">is_symlink</a>(file_status s);
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);
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 resize_file(const path&amp; p, uintmax_t size);
void resize_file(const path&amp; p, uintmax_t size, system::error_code&amp; ec);
<span style="background-color: #FFFFFF"> <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</span>, system::error_code&amp; ec<span style="background-color: #FFFFFF">);
</span><span style="background-color: #FFFF00">
</span> <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);
bool <a href="#status_known">status_known</a>(file_status s);
<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);
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="#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 filesystem
} // namespace boost</pre>
<h2><a name="Error-reporting">Error reporting</a></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></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 may not actually exist in external storage, and may contain pathnames which are not even valid for the current operating
system. </p>
<pre> namespace boost
{
namespace filesystem
{
class path
{
public:
typedef <b><i><a href="#value_type">see below</a></i></b> value_type; // char for POSIX, wchar_t for Windows
typedef std::basic_string&lt;value_type&gt; string_type;
typedef std::codecvt&lt;wchar_t, char, std::mbstate_t&gt; codecvt_type;
// <a href="#path-constructors">constructors</a> and destructor
path();
path(const path&amp; p);
template &lt;class <a href="#Source">Source</a>&gt;
path(Source const&amp; source, const codecvt_type&amp; cvt=codecvt());
template &lt;class <a href="#InputIterator">InputIterator</a>&gt;
path(InputIterator begin, InputIterator end, const codecvt_type&amp; cvt=codecvt());
~path();
// <a href="#path-assignments">assignments</a>
path&amp; operator=(const path&amp; p);
template &lt;class <a href="#Source">Source</a>&gt;
path&amp; operator=(Source const&amp; source);
template &lt;class <a href="#Source">Source</a>&gt;
path&amp; assign(Source const&amp; source, const codecvt_type&amp; cvt)
template &lt;class <a href="#InputIterator">InputIterator</a>&gt;
path&amp; assign(InputIterator begin, InputIterator end, const codecvt_type&amp; cvt=codecvt());
// <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);
template &lt;class <a href="#Source">Source</a>&gt;
path&amp; append(Source const&amp; source, const codecvt_type&amp; cvt);
template &lt;class <a href="#InputIterator">InputIterator</a>&gt;
path&amp; append(InputIterator begin, InputIterator end, const codecvt_type&amp; cvt=codecvt());
// <a href="#path-modifiers">modifiers</a>
void <a href="#path-clear">clear</a>();
path&amp; <a href="#absolute">make_absolute</a>(const path&amp; base);
path&amp; <a href="#path-make_preferred">make_preferred</a>(); // POSIX: no effect. Windows: convert slashes to backslashes
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; native() const; // native format, encoding
const value_type* c_str() const; // native().c_str()
template &lt;class String&gt;
String string(const codecvt_type&amp; cvt=codecvt()) const; // native format
const string string(const codecvt_type&amp; cvt=codecvt()) const; // native format
const wstring wstring(const codecvt_type&amp; cvt=codecvt()) const; // ditto
const u16string u16string() const; // ditto
const u32string u32string() const; // ditto
// <a href="#path-generic-format-observers">generic format observers</a>
template &lt;class String&gt;
String generic_string() const;
const string generic_string(const codecvt_type&amp; cvt=codecvt()) const; // generic format
const wstring generic_wstring(const codecvt_type&amp; cvt=codecvt()) const; // ditto
const u16string generic_u16string() const; // ditto
const u32string generic_u32string() const; // ditto
// <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;
// encoding conversion
static std::locale imbue( const std::locale&amp; loc );
static const codecvt_type &amp; codecvt();
private:
string_type pathname; // <b><i>exposition only</i></b>
};
} // namespace filesystem
} // namespace boost</pre>
<p><code><a name="value_type">value_type</a></code> is an implementation-defined typedef for the
character type used by the implementation to represent pathnames.</p>
<blockquote>
<p><i>[Note:</i> For POSIX-like implementations, including<b> </b>Unixes, Linux,
and Mac OS X, <code>path::value_type</code>
is <code>char</code> .</p>
<p>For Windows-like implementations, including
<a href="http://www.cygwin.com/">Cygwin</a> and
<a href="http://www.mingw.org/">MinGW</a>, <code>path::value_type</code> is <code>
wchar_t</code>.&nbsp;<i>--end note]</i></p>
</blockquote>
<p>For member functions described as returning <code>const string</code>, <code>
const wstring</code>, <code>const u16string</code>, or <code>const u32string</code>,
implementations are permitted to return <code>const string&amp;</code>, <code>const
wstring&amp;</code>, <code>const u16string&amp;</code>, or <code>const u32string&amp;</code>,
respectively.</p>
<blockquote>
<p>[<i>Note:</i> This allows implementations to avoid unnecessary copies when no
conversion is required.
Return-by-value is specified as
<code>const</code> to ensure programs won't break if moved to a return-by-reference
implementation. <i>--
end note</i>]</p>
</blockquote>
<p><code><a name="InputIterator">InputIterator</a></code> is required meet the
requirements for a C++ standard library <code>RandomIterator</code>
compliant iterator. The iterator's value type is required to be <code>char</code>, <code>
wchar_t</code>, <code>char16_t</code>, or <code>char32_t</code>.</p>
<p><code><a name="Source">Source</a></code> is required to be one of:</p>
<ul>
<li>A container with a value type of <code>char</code>, <code>
wchar_t</code>, <code>char16_t</code>, or <code>char32_t</code>.</li>
<li>An iterator for a null terminated byte-string. The value type is required
to be <code>char</code>, <code>wchar_t</code>, <code>char16_t</code>, or <code>
char32_t</code>.</li>
<li>A C-array. The value type is required to be <code>char</code>, <code>
wchar_t</code>, <code>char16_t</code>, or <code>char32_t</code>.</li>
<li>A <code>boost::filesystem::directory_entry</code>.</li>
</ul>
<p>The specifications for certain <code>path</code> functions require that
arguments in the generic pathname format be converted to native pathname format
as they are stored in <code>pathname</code>. If the native format requires
regular file paths and directory paths to be formatted differently, the
implementation shall determine which format to use according to whether or not
the last element of the generic format string is a separator. [<i>Example:</i>
On <a href="http://en.wikipedia.org/wiki/OpenVMS">OpenVMS</a>, a path
constructed from <code>&quot;/cats/jane&quot;</code> would considered a regular file
path, and have a native format of <code>&quot;[CATS]JANE&quot;</code>, while a
path constructed from <code>&quot;/cats/jane/&quot;</code> would be considered a
directory path, and have a native format of <code>&quot;[CATS.JANE]&quot;</code>.
<i>--end example</i>] [<i>Note</i>: POSIX and Windows use the same native format
for regular file and directory pathnames, so this paragraph does not apply to
them. <i>--end note</i>]</p>
<table align="center" border="1" cellpadding="3" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%">
<tr>
<td style="font-size: 10pt">
Class <code>path</code> does not currently map invalid characters in
filenames to valid characters. In the future we might add something like
this:<blockquote>
<p>When converting filenames to the native operating system format,
implementations are encouraged, but not required, to convert otherwise invalid
characters or character sequences to valid characters or character sequences.
Such conversions are implementation-defined.</p>
<blockquote>
<p>[<i>Note:</i> Filename conversion allows much wider portability of both
programs and filenames that would otherwise be possible.</p>
<p>Implementations are encouraged to base conversion on existing standards or
practice. Examples include the Uniform Resource Locator escape syntax of a percent sign (<code>'%'</code>)
followed by two hex digits representing the character value. On
<i>OpenVMS</i>, which does not allow percent signs in filenames, a dollar sign (<code>'$'</code>)
followed by two hex digits is the existing practice, as is converting lowercase
letters to uppercase.<i> -- end note.</i>]</p>
</blockquote>
</blockquote>
</td>
</tr>
</table>
<h3> <a name="path-constructors"> <code>
<font size="4">path</font></code> constructors</a></h3>
<pre>path();</pre>
<blockquote>
<p><i>Postconditions:</i> <code>empty()</code>.</p>
</blockquote>
<pre>template &lt;class <a href="#Source">Source</a>&gt;
path(Source const&amp; source, const codecvt_type&amp; cvt=codecvt());</pre>
<pre>template &lt;class <a href="#InputIterator">InputIterator</a>&gt;
path(InputIterator begin, InputIterator end, const codecvt_type&amp; cvt=codecvt());</pre>
<blockquote>
<p><i>Effects:</i> Stores the contents [<code>begin</code>,<code>end</code>)
or <code>source</code> in <code>pathname</code>. If the contents are in the
generic format, they are converted to the native format. [<i>Note:</i> For
POSIX and Windows based implementations, the generic format is already
acceptable as a native format, so no generic to native conversion is
performed. <i>--end note</i>]</p>
<p>
<i>Remarks:</i> If the value type of&nbsp; [<code>begin</code>,<code>end</code>)
or <code>source</code> is not <code>value_type</code>, conversion is performed
by <code>cvt</code>.</p>
</blockquote>
<h3> <a name="path-assignments"> <code>
<font size="4">path</font></code> assignments</a></h3>
<pre>template &lt;class <a href="#Source">Source</a>&gt;
path&amp; operator=(Source const&amp; source);</pre>
<pre>template &lt;class <a href="#Source">Source</a>&gt;
path&amp; assign(Source const&amp; source, const codecvt_type&amp; cvt);</pre>
<pre>template &lt;class <a href="#InputIterator">InputIterator</a>&gt;
path&amp; assign(InputIterator begin, InputIterator end, const codecvt_type&amp; cvt=codecvt());</pre>
<blockquote>
<p><i>Effects:</i> Stores the contents [<code>begin</code>,<code>end</code>)
or <code>source</code> in <code>pathname</code>. If the contents are in the
generic format, they are converted to the native format. [<i>Note:</i> For
POSIX and Windows based implementations, the generic format is already
acceptable as a native format, so no generic to native conversion is
performed. <i>--end note</i>]</p>
<p>
<i>Returns: </i><code>*this</code></p>
<p>
<i>Remarks:</i> If the value type of&nbsp; [<code>begin</code>,<code>end</code>)
or <code>source</code> is not <code>value_type</code>, conversion is performed
by <code>cvt</code>.</p>
</blockquote>
<h3> <a name="path-appends"><code><font size="4"> path</font></code> appends</a></h3>
<p>The append operations use <code>operator/=</code> to denote their semantic
effect of appending the platform's preferred directory separator when needed. The
preferred
directory separator is implementation-defined.</p>
<blockquote>
<p align="left">[<i>Note: </i>For POSIX-like implementations, including<b> </b>
Unix variants, Linux, and Mac OS X, the preferred directory separator is a
single forward slash.</p>
<p align="left">For Windows-like implementations, including
<a href="http://www.cygwin.com/">Cygwin</a> and
<a href="http://www.mingw.org/">MinGW</a>, the preferred directory
separator is a single backslash.<i>--end note</i>]</p>
</blockquote>
<pre>path&amp; operator/=(const path&amp; p);</pre>
<blockquote>
<p><i>Effects:</i></p>
<blockquote>
Appends the preferred directory separator to the contained pathname, unless:<ul>
<li>an added separator
would be redundant, or</li>
<li>would change an relative path to an absolute path, or</li>
<li><code>p.empty()</code>, or</li>
<li><code>*p.native().cbegin()</code> is a directory separator.</li>
</ul>
<p>Appends <code>p.native()</code> to <code>pathname</code>.</p>
</blockquote>
<p><i>Returns: </i><code>*this</code></p>
</blockquote>
<pre>template &lt;class <a href="#Source">Source</a>&gt;
path&amp; operator/=(Source const &amp; source);</pre>
<pre>template &lt;class <a href="#Source">Source</a>&gt;
path&amp; append(Source const &amp; source, const codecvt_type&amp; cvt);</pre>
<pre>template &lt;class <a href="#InputIterator">InputIterator</a>&gt;
path&amp; append(InputIterator begin, InputIterator end, const codecvt_type&amp; cvt=codecvt());</pre>
<blockquote>
<p><i>Effects:</i></p>
<blockquote>
<p>Appends a native directory separator to the contained pathname, unless:</p>
<ul>
<li>an added separator
would be redundant, or</li>
<li>would change an relative path to an absoute path, or</li>
<li><code>p.empty()</code>, or</li>
<li><code>*p.native().cbegin()</code> is a separator.</li>
</ul>
<p>Appends the contents [<code>begin</code>,<code>end</code>)
or <code>source</code> to <code>pathname</code>. If the contents are in the
generic format, they are converted to the native format. [<i>Note:</i> For
POSIX and Windows based implementations, the generic format is already
acceptable as a native format, so no generic to native conversion is
performed. <i>--end note</i>]</p>
</blockquote>
<p><i>Remarks:</i> If the value type of&nbsp; [<code>begin</code>,<code>end</code>)
or <code>source</code> is not <code>value_type</code>, conversion is performed
by <code>cvt</code>.</p>
<p><i>Returns: </i><code>*this</code></p>
</blockquote>
<h3> <a name="path-modifiers"> <code>
<font size="4">path</font></code> modifiers</a></h3>
<pre>void <a name="path-clear">clear</a>();</pre>
<blockquote>
<p><i>Postcondition:</i> <code>this-&gt;empty()</code> is true.</p>
</blockquote>
<pre>path&amp; <a name="path-make_preferred">make_preferred</a>();</pre>
<blockquote>
<p><i>Effects:</i> The contained pathname is converted to the preferred native
format. [<i>Note:</i> On Windows, the effect is to replace slashes with
backslashes. On POSIX, there is no effect. <i>-- end note</i>]</p>
<p><i>Returns:</i> <code>*this</code></p>
</blockquote>
<pre>path&amp; <a name="path-remove_filename">remove_filename</a>();</pre>
<blockquote>
<p><i>Returns: </i>As if, <code>*this = parent_path();</code></p>
<p>[<i>Note:</i> This function is needed to efficiently implement <code>
directory_iterator</code>. It is exposed to allow additional uses. The actual
implementation may be much more efficient than <code>*this = parent_path()</code>&nbsp; <i>-- end
note</i>]</p>
</blockquote>
<pre>path&amp; <a name="path-replace_extension">replace_extension</a>(const path&amp; new_extension = path());</pre>
<blockquote>
<p><i>Postcondition: </i> <code>extension() == <i>replacement</i></code>,
where <code><i>replacement</i></code> is <code>new_extension</code> if <code>
new_extension.empty() || new_extension[0] ==</code> the dot character,
otherwise <code><i>replacement</i></code> is the dot character followed by
<code>new_extension</code>.</p>
<p><i>Returns:</i> <code>*this</code></p>
</blockquote>
<pre><code><span style="background-color: #FFFFFF">void <a name="path-swap">swap</a>(path&amp; rhs);</span></code></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF">
Swaps the contents of the two paths.</span></p>
<p><i><span style="background-color: #FFFFFF">Throws: </span></i>
<span style="background-color: #FFFFFF">nothing.</span></p>
<p><i><span style="background-color: #FFFFFF">Complexity: </span></i>
<span style="background-color: #FFFFFF">constant time.</span></p>
</blockquote>
<h3> <a name="path-native-format-observers"><code><font size="4">path</font></code>
native format observers</a></h3>
<p>The string returned by all native format observers is in the
<a href="#native-pathname-format">native pathname format</a>.</p>
<pre>const string_type&amp; native() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>pathname</code>.</p>
<p><i>Throws:</i> nothing.</p>
</blockquote>
<pre>const value_type* c_str() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>pathname.c_str()</code>.</p>
<p><i>Throws:</i> nothing.</p>
</blockquote>
<pre>template &lt;class String&gt;
String string(const codecvt_type&amp; cvt=codecvt()) const;</pre>
<blockquote>
<p><i>Returns:</i> <code>pathname</code>.</p>
<p><i>Remarks:</i> If <code>string_type</code> is a different type than <code>
String</code>, conversion is performed by <code>cvt</code>.</p>
</blockquote>
<pre>const string string(const codecvt_type&amp; cvt=codecvt()) const;
const wstring wstring(const codecvt_type&amp; cvt=codecvt()) const;
const u16string u16string() const;
const u32wstring u32wstring() const; </pre>
<blockquote>
<p><i>Returns:</i> <code>pathname</code>.</p>
<p><i>Remarks:</i> If <code>string_type</code> is a different type than
function's return type, conversion is performed by <code>cvt</code>.</p>
<p>If <code>string_type</code> is the same type as the
function's return type, the function is permitted to return by <code>const&amp;</code>
rather than <code>const</code> value. [<i>Note:</i> For POSIX, this occurs for
<code>string()</code>, for Windows, <code>wstring()</code>. <i>--end note</i>]</p>
</blockquote>
<h3> <a name="path-generic-format-observers"><code><font size="4">path</font></code>
generic format observers</a></h3>
<p>The string returned by all generic format observers is in the
<a href="#generic-pathname-format">generic pathname format</a>.</p>
<p>[<i>Note:</i> For POSIX, no conversion occurs, since the native format and
generic format are the same. For Windows, backslashes are converted to slashes
<i>--end note</i>]</p>
<pre>template &lt;class String&gt;
String generic_string(const codecvt_type&amp; cvt=codecvt()) const;</pre>
<blockquote>
<p><i>Returns:</i> <code>pathname</code>.</p>
<p><i>Remarks:</i> If <code>string_type</code> is a different type than <code>
String</code>, conversion is performed by
<code>cvt</code>.</p>
</blockquote>
<pre>const string generic_string(const codecvt_type&amp; cvt=codecvt()) const;
const wstring generic_wstring(const codecvt_type&amp; cvt=codecvt()) const;
const u16string generic_u16string() const;
const u32wstring generic_u32wstring() const; </pre>
<blockquote>
<p><i>Returns:</i> <code>pathname</code>.</p>
<p><i>Remarks:</i>&nbsp; If <code>string_type</code> is a different type than
function's return type, conversion is performed by <code>cvt</code>.</p>
<p>If <code>string_type</code> is of the same type as the
function's return type, and the generic format is the same as the native format,
the function is permitted to return by <code>const&amp;</code> rather than <code>
const</code> value. [<i>Note:</i> For POSIX, this occurs for <code>string()</code>.
It never occurs for Windows, because backslashes must be converted to slashes.
<i>--end note</i>]</p>
</blockquote>
<h3> <a name="path-decomposition"> <code><font size="4">path</font></code>
decomposition</a></h3>
<p><span style="background-color: #E0E0E0"><i>See the
<a href="#Path-decomposition-table">Path decomposition table</a> for examples
for values returned by decomposition functions. The
<a href="tutorial.html#Using-path-decomposition">Tutorial</a> may also be
helpful.</i></span></p>
<pre>path <a name="path-root_name">root_name</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <i>root-name,</i> if <code>pathname</code> includes <i>
root-name</i>, otherwise <code>path()</code>. </p>
</blockquote>
<pre>path <a name="path-root_directory">root_directory</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <i>root-directory</i>, if <code>pathname</code> includes <i>
root-directory</i>, otherwise <code>path()</code>.</p>
<p>If <i>root-directory</i> is composed of <i>slash name</i>, <i>slash</i> is
excluded from the returned string.</p>
</blockquote>
<pre>path <a name="path-root_path">root_path</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>root_name() / root_directory()</code></p>
</blockquote>
<pre>path <a name="path-relative_path">relative_path</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> A <code>path</code> composed from <code>pathname</code>, if <code>
!empty()</code>, beginning
with the first <i>filename</i> after <i>root-path</i>. Otherwise, <code>path()</code>.</p>
</blockquote>
<pre>path <a name="path-parent_path">parent_path</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>(empty() || begin() == --end()) ? path() : <i>pp</i></code>, where
<code><i>pp</i></code> is constructed as if by
starting with an empty <code>path</code> and successively applying <code>
operator/=</code> for each element in the range <code>begin()</code>, <code>
--end()</code>.</p>
</blockquote>
<pre>path <a name="path-filename">filename</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>empty() ? path() : *--end()</code></p>
<p>[<i>Example:</i></p>
<blockquote>
<pre><code>std::cout &lt;&lt; path(&quot;/foo/bar.txt&quot;).filename();</code> // outputs &quot;<code>bar.txt</code>&quot; (without the quotes)</pre>
</blockquote>
<p> <i>--end example</i>]</p>
</blockquote>
<pre>path <a name="path-stem">stem</a>(const path&amp; p) const;</pre>
<blockquote>
<p><i>Returns:</i> if <code>p.filename()</code>contains a dot but does not
consist solely of one or to two dots, returns
the substring of <code>p.filename()</code> starting at its beginning and
ending at the last dot (the dot is not included). Otherwise,
returns <code>
p.filename()</code>.</p>
<p>[<i>Example:</i></p>
<blockquote>
<pre><code>std::cout &lt;&lt; path(&quot;/foo/bar.txt&quot;).stem();</code> // outputs &quot;<code>bar</code>&quot; (without the quotes)</pre>
<pre>path p = &quot;foo.bar.baz.tar&quot;;
for (; !p.extension().empty(); p = p.stem())
std::cout &lt;&lt; p.extension() &lt;&lt; '\n';
// outputs: .tar
// .baz
// .bar</pre>
</blockquote>
<p> <i>--end example</i>]</p>
</blockquote>
<pre>path <a name="path-extension">extension</a>(const path&amp; p) const;</pre>
<blockquote>
<p><i>Returns:</i> if <code>p.filename()</code> contains a dot but does not
consist solely of one or to two dots, returns
the substring of <code>p.filename()</code> starting at the rightmost dot
and ending at the path's end. Otherwise, returns an empty <code>path</code>
object. </p>
<p><i>Remarks:</i> Implementations are permitted but not required to define additional
behavior for file systems which append additional elements to extensions, such
as alternate data streams or partitioned dataset names.</p>
<p>[<i>Example:</i></p>
<blockquote>
<pre><code>std::cout &lt;&lt; path(&quot;/foo/bar.txt&quot;).extension(); //</code> outputs &quot;<code>.txt</code>&quot; (without the quotes)</pre>
</blockquote>
<p> <i>--end example</i>]</p>
<p>[<i>Note:<b> </b></i>The dot is included in the return value so that
it is possible to distinguish between no extension and an empty extension. See
<a href="http://permalink.gmane.org/gmane.comp.lib.boost.devel/199744">
http://permalink.gmane.org/gmane.comp.lib.boost.devel/199744</a> for more
extensive rationale.&nbsp; <i>-- end note</i>]</p>
</blockquote>
<h3> <a name="path-query"> <code><font size="4">path</font></code> query</a></h3>
<pre>bool <a name="path-empty">empty</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>m_pathname.empty()</code>.</p>
</blockquote>
<pre>bool <a name="path-has_root_path">has_root_path</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>!<a href="#path-root_path">root_path</a>().empty()</code></p>
</blockquote>
<pre>bool <a name="path-has_root_name">has_root_name</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>!<a href="#path-root_name">root_name</a>().empty()</code></p>
</blockquote>
<pre>bool <a name="path-has_root_directory">has_root_directory</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>!<a href="#path-root_directory">root_directory</a>().empty()</code></p>
</blockquote>
<pre>bool <a name="path-has_relative_path">has_relative_path</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>!<a href="#path-has_relative_path">relative_path</a>().empty()</code></p>
</blockquote>
<pre>bool <a name="path-has_parent_path">has_parent_path</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>!<a href="#path-parent_path">parent_path</a>().empty()</code></p>
</blockquote>
<pre>bool <a name="path-has_filename">has_filename</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>!<a href="#path-filename">filename</a>().empty()</code></p>
</blockquote>
<pre>bool <a name="path-has_stem">has_stem</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>!<a href="#path-stem">stem</a>().empty()</code></p>
</blockquote>
<pre>bool <a name="path-has_extension">has_extension</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>!<a href="#path-has_extension">extension</a>().empty()</code></p>
</blockquote>
<pre>bool <a name="path-is_absolute">is_absolute</a>() const;</pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>true</code>
if the elements of <code>root_path()</code> uniquely identify a directory, else <code>false</code>.</span></p>
<p><span style="background-color: #FFFFFF">[<i>Note:</i> On POSIX,<code>
path(&quot;/foo&quot;).is_absolute()</code> returns <code>true</code>. On Windows, <code>
path(&quot;/foo&quot;).is_absolute()</code> returns <code>false</code>. <i>--end note</i>]</span></p>
</blockquote>
<pre>bool <a name="path-is_relative">is_relative</a>() const;</pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>!is_absolute()</code>.</span></p>
</blockquote>
<h3> <a name="path-iterators"> <code>
<font size="4">path</font></code> iterators</a></h3>
<p> A <code>path::iterator</code> is a constant iterator satisfying all
the requirements of a bidirectional iterator (C++ Std, 24.1.4 Bidirectional
iterators [lib.bidirectional.iterators]). Its <code>value_type</code> is <code>
path</code>.</p>
<p>Calling any non-const member function of a <code>path</code> object
invalidates all iterators referring to elements of that object.</p>
<p> The forward traversal order is as follows:</p>
<ul>
<li>The <i>root-name</i> element, if present.</li>
<li>The <i>root-directory</i> element, if present.</li>
<li>Each successive <i>filename</i> element, if present.</li>
<li><i>Dot</i>, if one or more trailing non-root <i>slash</i>
characters are present.</li>
</ul>
<p>The backward traversal order is the reverse of forward traversal.</p>
<pre>iterator begin() const;</pre>
<blockquote>
<p><i>Returns:</i> An iterator for the first present element in the traversal
list above. If no elements are present, the end iterator.</p>
</blockquote>
<pre>iterator end() const;</pre>
<blockquote>
<p><i>Returns:</i> The end iterator.</p>
</blockquote>
<h3> <a name="path-deprecated-functions"><code><font size="4"> path</font></code> deprecated functions</a></h3>
<p> Several member functions from previous versions of <code>class path</code>
have been deprecated, either because they have been renamed or because the
functionality is no longer desirable or has become obsolete.</p>
<p> Deprecated functions available by default; will be suppressed if <code>
BOOST_FILESYSTEM_NO_DEPRECATED</code> is defined:</p>
<blockquote>
<pre>path&amp; remove_leaf() { return remove_filename(); }
path leaf() const { return filename(); }
path branch_path() const { return parent_path(); }
bool has_leaf() const { return !m_path.empty(); }
bool has_branch_path() const { return !parent_path().empty(); }</pre>
</blockquote>
<p> Deprecated functions not available by default; will be supplied if <code>
BOOST_FILESYSTEM_DEPRECATED</code> is defined:</p>
<blockquote>
<pre>const std::string file_string() const { return native_string(); }
const std::string directory_string() const { return native_string(); }
const std::string native_file_string() const { return native_string(); }
const std::string native_directory_string() const { return native_string(); }
const string_type external_file_string() const { return native(); }
const string_type external_directory_string() const { return native(); }</pre>
</blockquote>
<h3> <a name="path-non-member-functions"> <code><font size="4">path</font></code>
<span style="background-color: #FFFFFF">non-member functions</span></a></h3>
<pre><span style="background-color: #FFFFFF">void swap( path&amp; lhs, path&amp; rhs )</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Effects: </span></i><code>
<span style="background-color: #FFFFFF">lhs.swap(rhs)</span></code>.</p>
</blockquote>
<pre>bool lexicographical_compare(path::iterator first1, path::iterator last1,
path::iterator first2, path::iterator last2)</pre>
<blockquote>
<p><i>Returns:</i> <code>true</code> if the sequence of <code>native()</code>
strings for the elements defined by the range <code>[first1,last1)</code> is
lexicographically less than the sequence of <code>native()</code> strings for
the elements defined by the range <code>[first2,last2)</code>. Returns <code>
false</code> otherwise.</p>
<p><i>Remarks:</i> If two sequences have the same number of elements and their
corresponding elements are equivalent, then neither sequence is
lexicographically less than the other. If one sequence is a prefix of the
other, then the shorter sequence is lexicographically less than the longer
sequence. Otherwise, the lexicographical comparison of the sequences yields
the same result as the comparison of the first corresponding pair of elements
that are not equivalent.</p>
<pre> for ( ; first1 != last1 &amp;&amp; first2 != last2 ; ++first1, ++first2) {
if (first1-&gt;native() &lt; first2-&gt;native()) return true;
if (first2-&gt;native() &lt; first1-&gt;native()) return false;
}
return first1 == last1 &amp;&amp; first2 != last2;</pre>
<p>[<i>Note:</i> A <code>path</code> aware<code> lexicographical_compare</code>
is provided to avoid infinite recursion in <code>std::lexicographical_compare</code>
due to the <code>path</code> iterator's value type itself being <code>path</code>.
<i>--end note</i>]</p>
</blockquote>
<pre>bool operator&lt; (const path&amp; lhs, const path&amp; rhs);</pre>
<blockquote>
<p><i>Returns:</i> <code>return lexicographical_compare(lhs.begin(), lhs.end(),
rhs.begin(), rhs.end())</code>.</p>
</blockquote>
<pre>bool operator&lt;=(const path&amp; lhs, const path&amp; rhs);</pre>
<blockquote>
<p><i>Returns:</i> <code>!(rhs &lt; lhs)</code>.</p>
</blockquote>
<pre>bool operator&gt; (const path&amp; lhs, const path&amp; rhs);</pre>
<blockquote>
<p><i>Returns:</i> <code>rhs &lt; lhs</code>.</p>
</blockquote>
<pre>bool operator&gt;=(const path&amp; lhs, const path&amp; rhs);</pre>
<blockquote>
<p><i>Returns:</i> <code>!(lhs &lt; rhs)</code>.</p>
</blockquote>
<pre>bool operator==(const path&amp; lhs, const path&amp; rhs);</pre>
<blockquote>
<p><i>Returns:</i> <code>!(lhs &lt; rhs) &amp;&amp; !(rhs &lt; lhs)</code>.</p>
<p>[<i>Note:</i> Actual implementations may use an equivalent, but more
efficient, algorithm. <i>--end note</i>]</p>
<p>[<i>Note:</i> <a name="Path-equality">Path equality</a> and path
equivalence have different semantics.</p>
<p>Equality is determined by the <code>path</code>
non-member <code>operator==</code>, which considers the two path's lexical
representations only. Thus <code>path(&quot;foo&quot;) == &quot;bar&quot;</code> is never
<code>true</code>.</p>
<p>Equivalence is determined by the <a href="#equivalent"><code>equivalent()</code></a>
non-member function, which determines if two paths <a href="#Path">resolve</a> to the same file system entity.
Thus <code>equivalent(&quot;foo&quot;, &quot;bar&quot;)</code> will be <code>true</code>
when both paths resolve to the same file.</p>
<p>Programmers wishing to determine if two paths are &quot;the same&quot; must decide if
&quot;the same&quot; means &quot;the same representation&quot; or &quot;resolve to the same actual
file&quot;, and choose the appropriate function accordingly. <i>
-- end note</i>]</p>
</blockquote>
<pre>bool operator!=(const path&amp; lhs, const path&amp; rhs);</pre>
<blockquote>
<p><i>Returns:</i> <code>!(lhs == rhs)</code>.</p>
</blockquote>
<pre>path operator/ (const path&amp; lhs, const path&amp; rhs);</pre>
<blockquote>
<p><i>Returns:</i> <code>path(lhs) /= rhs</code>.</p>
</blockquote>
<h3> <a name="path-non-member-operators"><code><font size="4">path</font></code></a><a name="path-inserter-extractor"><span style="background-color: #FFFFFF"> inserter
and extractor</span></a></h3>
<p> The inserter and extractor delimit the string with double-quotes (<code>&quot;</code>)
to ensure that paths with embedded spaces will round trip correctly. Ampersand (<code>&amp;</code>)
is used as an escape character, so the path can itself contain double quotes.</p>
<pre>template &lt;class Char, class Traits&gt;
std::basic_ostream&lt;Char, Traits&gt;&amp; operator&lt;&lt;(std::basic_ostream&lt;Char, Traits&gt;&amp; os, const path&amp; p)
</pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF">&nbsp;
<code>os &lt;&lt; <a href="../../../io/doc/quoted_manip.html">
boost::io::quoted</a>(p.string&lt;std::basic_string&lt;Char&gt;&gt;(), static_cast&lt;Char&gt;('&amp;'));</code></span></p>
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
</span> <code><span style="background-color: #FFFFFF">os</span></code></p>
</blockquote>
<pre>template &lt;class Char, class Traits&gt;
inline std::basic_istream&lt;Char, Traits&gt;&amp; operator&gt;&gt;(std::basic_istream&lt;Char, Traits&gt;&amp; is, path&amp; p)
</pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Effects:&nbsp; </i>
<code>&nbsp;std::basic_string&lt;Char&gt; str;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is &gt;&gt;
<a href="../../../io/doc/quoted_manip.html">boost::io::quoted</a>(str,
static_cast&lt;Char&gt;('&amp;'));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p = str;</code></span></p>
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
</span> <code><span style="background-color: #FFFFFF">is</span></code></p>
</blockquote>
<h3><a name="Class-filesystem_error">Class <code>filesystem_error</code></a></h3>
<pre> namespace boost
{
namespace filesystem
{
class basic_filesystem_error : public <span style="background-color: #FFFFFF">system</span>_error
{
public:
filesystem_error();
filesystem_error(const filesystem_error&amp;);
<a href="#filesystem_error-2-arg">filesystem_error</a>(const std::string&amp; <span style="background-color: #FFFFFF">what_arg</span>, system::error_code ec);
<a href="#filesystem_error-3-arg">filesystem_error</a>(const std::string&amp; <span style="background-color: #FFFFFF">what_arg</span>, const path&amp; p1, system::error_code ec);
<a href="#filesystem_error-4-arg">filesystem_error</a>(const std::string&amp; <span style="background-color: #FFFFFF">what_arg</span>, const path&amp; p1, const path&amp; p2, system::error_code ec);
filesystem_error&amp; filesystem_error(const filesystem_error&amp;);
~filesystem_error();
filesystem_error&amp; operator=(const filesystem_error&amp;);
const path&amp; <a href="#filesystem_error-path1">path1</a>() const;
const path&amp; <a href="#filesystem_error-path2">path2</a>() const;
const char * <a href="#filesystem_error-what">what</a>() const;
};
} // namespace filesystem
} // namespace boost</pre>
<p>The class template <code>basic_filesystem_error</code> defines the type of
objects thrown as exceptions to report file system errors from functions described in this
clause.</p>
<h4> <a name="filesystem_error-members"> <code>filesystem_error</code> members</a></h4>
<pre><a name="filesystem_error-2-arg">filesystem_error</a>(const std::string&amp; <span style="background-color: #FFFFFF">what_arg</span>, error_code ec);</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="46%">
<tr>
<td width="18%"><b>Expression</b></td>
<td width="82%"><b>Value</b></td>
</tr>
<tr>
<td width="18%" bgcolor="#FFFFFF"><code>
<span style="background-color: #FFFFFF">runtime_error::what</span>()</code></td>
<td width="82%" bgcolor="#FFFFFF"><span style="background-color: #FFFFFF">
<code><i>what_arg</i>.c_str()</code></span></td>
</tr>
<tr>
<td width="18%"><code>code()</code></td>
<td width="82%"><code>ec</code></td>
</tr>
<tr>
<td width="18%"><code>path1().empty()</code></td>
<td width="82%"><code>true</code></td>
</tr>
<tr>
<td width="18%"><code>path2().empty()</code></td>
<td width="82%"><code>true</code></td>
</tr>
</table>
</blockquote>
<pre><a name="filesystem_error-3-arg">filesystem_error</a>(const std::string&amp; <span style="background-color: #FFFFFF">what_arg</span>, const path_type&amp; p1, error_code ec);</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="46%">
<tr>
<td width="18%"><b>Expression</b></td>
<td width="82%"><b>Value</b></td>
</tr>
<tr>
<td width="18%" valign="top"><code>
<span style="background-color: #FFFFFF">runtime_error::what</span>()</code></td>
<td width="82%"><span style="background-color: #FFFFFF">
<code><i>what_arg</i>.c_str()</code></span></td>
</tr>
<tr>
<td width="18%" valign="top"><code>code()</code></td>
<td width="82%"><code>ec</code></td>
</tr>
<tr>
<td width="18%" valign="top"><code>path1()</code></td>
<td width="82%"><span style="background-color: #FFFFFF">Reference to stored copy of
</span> <code>p1</code></td>
</tr>
<tr>
<td width="18%" valign="top"><code>path2().empty()</code></td>
<td width="82%"><code>true</code></td>
</tr>
</table>
</blockquote>
<pre><a name="filesystem_error-4-arg">filesystem_error</a>(const std::string&amp; <span style="background-color: #FFFFFF">what_arg</span>, const path_type&amp; p1, const path_type&amp; p2, error_code ec);</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="46%">
<tr>
<td width="18%"><b>Expression</b></td>
<td width="82%"><b>Value</b></td>
</tr>
<tr>
<td width="18%"><code>
<span style="background-color: #FFFFFF">runtime_error::what</span>()</code></td>
<td width="82%"><span style="background-color: #FFFFFF">
<u>
<code><i>w</i></code></u><code><i>hat_arg</i>.c_str()</code></span></td>
</tr>
<tr>
<td width="18%"><code>code()</code></td>
<td width="82%"><code>ec</code></td>
</tr>
<tr>
<td width="18%"><code>path1()</code></td>
<td width="82%"><span style="background-color: #FFFFFF">Reference to stored copy of
</span> <code>p1</code></td>
</tr>
<tr>
<td width="18%"><code>path2()</code></td>
<td width="82%"><span style="background-color: #FFFFFF">Reference to stored copy of
</span> <code>p2</code></td>
</tr>
</table>
</blockquote>
<pre>const path&amp; <a name="filesystem_error-path1">path1</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> Reference to copy of <code>p1</code> stored by the
constructor, or, if none, an empty path.</p>
</blockquote>
<pre>const path&amp; <a name="filesystem_error-path2">path2</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> Reference to copy of <code>p2</code> stored by the
constructor, or, if none, an empty path.</p>
</blockquote>
<pre>const char* <a name="filesystem_error-what">what</a>() const;</pre>
<blockquote>
<p><i>Returns: </i>A string containing <code>runtime_error::what()</code>. The exact format is unspecified.
Implementations are encouraged but not required to include <code>
path1.native_string()</code>if not empty, <code>path2.native_string()</code>if
not empty, and <code>system_error::what()</code> strings in the returned
string.</p>
</blockquote>
<h3><a name="Class-directory_entry">Class <code>directory_entry</code></a></h3>
<pre> namespace boost
{
namespace filesystem
{
class directory_entry
{
public:
// <a href="#directory_entry-constructors">constructors</a> and destructor
directory_entry();
directory_entry(const directory_entry&amp;);
explicit directory_entry(const path_type&amp; p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
~directory_entry();
// <a href="#directory_entry-modifiers">modifiers</a>
directory_entry&amp; operator=(const directory_entry&amp;);
void assign(const path_type&amp; p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
void replace_filename(const path&amp; p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
// <a href="#directory_entry-observers">observers</a>
const path&amp; path() const;
<span style="background-color: #FFFFFF"> file_status status(system::error_code&amp; ec) const;
file_status symlink_status(system::error_code&amp; ec) const;
bool operator&lt; (const directory_entry&amp; rhs);
bool operator==(const directory_entry&amp; rhs);
bool operator!=(const directory_entry&amp; rhs);
bool operator&lt; (const directory_entry&amp; rhs);
bool operator&lt;=(const directory_entry&amp; rhs);
bool operator&gt; (const directory_entry&amp; rhs);
bool operator&gt;=(const directory_entry&amp; rhs);
</span><span style="background-color: #FFFF00">
</span> private:
path_type m_path; // for exposition only
mutable <span style="background-color: #FFFFFF">file_status</span> m_status; // for exposition only; stat()-like
mutable <span style="background-color: #FFFFFF">file_status</span> m_symlink_status; // for exposition only; lstat()-like
};
} // namespace filesystem
} // namespace boost</pre>
<p>A <code>directory_entry</code> object stores a <code>path object</code>,
a <code>file_status</code> object for non-symbolic link status, and a <code>
file_status</code> object for symbolic link status. The <code>file_status</code>
objects act as value caches.</p>
<blockquote>
<p>[<i>Note:</i> Because <code>status()</code>on a pathname may be a very expensive operation,
some operating systems provide status information as a byproduct of directory
iteration. Caching such status information can result is significant time savings. Cached and
non-cached results may differ in the presence of race conditions. <i>-- end note</i>]</p>
<p><span style="background-color: #E0E0E0"><i>Actual cold-boot timing of iteration over
a directory with 15,047 entries was six seconds for non-cached status queries
versus one second for cached status queries. Windows XP, 3.0 GHz processor, with
a moderately fast hard-drive. Similar speedups are expected on Linux and BSD-derived
systems that provide status as a by-product of directory iteration.</i></span></p>
</blockquote>
<h4> <a name="directory_entry-constructors"> <code>directory_entry </code>constructors</a></h4>
<pre>directory_entry();</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="36%">
<tr>
<td width="18%"><b>Expression</b></td>
<td width="82%"><b>Value</b></td>
</tr>
<tr>
<td width="18%"><code>path().empty()</code></td>
<td width="82%"><code>true</code></td>
</tr>
<tr>
<td width="18%"><code>status()</code></td>
<td width="82%"><code>file_status()</code></td>
</tr>
<tr>
<td width="18%"><code>symlink_status()</code></td>
<td width="82%"><code>file_status()</code></td>
</tr>
</table>
</blockquote>
<pre>explicit directory_entry(const path_type&amp; p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="36%">
<tr>
<td width="18%"><b>Expression</b></td>
<td width="82%"><b>Value</b></td>
</tr>
<tr>
<td width="18%"><code>path()</code></td>
<td width="82%"><code>p</code></td>
</tr>
<tr>
<td width="18%"><code>status()</code></td>
<td width="82%"><code>st</code></td>
</tr>
<tr>
<td width="18%"><code>symlink_status()</code></td>
<td width="82%"><code>symlink_st</code></td>
</tr>
</table>
</blockquote>
<h4> <a name="directory_entry-modifiers"> <code>directory_entry </code>modifiers</a></h4>
<pre>void assign(const path_type&amp; p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="36%">
<tr>
<td width="18%"><b>Expression</b></td>
<td width="82%"><b>Value</b></td>
</tr>
<tr>
<td width="18%"><code>path()</code></td>
<td width="82%"><code>p</code></td>
</tr>
<tr>
<td width="18%"><code>status()</code></td>
<td width="82%"><code>st</code></td>
</tr>
<tr>
<td width="18%"><code>symlink_status()</code></td>
<td width="82%"><code>symlink_st</code></td>
</tr>
</table>
</blockquote>
<pre>void replace_filename(const path&amp; p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="43%">
<tr>
<td width="18%"><b>Expression</b></td>
<td width="82%"><b>Value</b></td>
</tr>
<tr>
<td width="18%"><code>path()</code></td>
<td width="82%"><code>path().branch() / s</code></td>
</tr>
<tr>
<td width="18%"><code>status()</code></td>
<td width="82%"><code>st</code></td>
</tr>
<tr>
<td width="18%"><code>symlink_status()</code></td>
<td width="82%"><code>symlink_st</code></td>
</tr>
</table>
</blockquote>
<h4> <a name="directory_entry-observers"> <code>directory_entry</code> observers</a></h4>
<pre>const path&amp; path() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>m_path</code></p>
</blockquote>
<pre><span style="background-color: #FFFFFF">file_status status(system::error_code&amp; ec) const;</span></pre>
<blockquote>
<p><span style="font-style: italic; background-color: #FFFFFF">Effects:</span><span style="background-color: #FFFFFF">
As if,</span></p>
<blockquote>
<pre><span style="background-color: #FFFFFF">if ( !status_known( m_status ) )
{
if ( status_known(m_symlink_status) &amp;&amp; !is_symlink(m_symlink_status) )
{ m_status = m_symlink_status; }
else { m_status = status(m_path, ec); }
}
else if ( &amp;ec != &amp;boost::throws() ) ec.clear();</span></pre>
</blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_status</code></span></p>
</blockquote>
<pre><span style="background-color: #FFFFFF">file_status symlink_status(system::error_code&amp; ec) const;</span></pre>
<blockquote>
<p><span style="font-style: italic; background-color: #FFFFFF">Effects:</span><span style="background-color: #FFFFFF">
As if,</span></p>
<blockquote>
<pre><span style="background-color: #FFFFFF">if ( !status_known( m_symlink_status ) )
{
m_symlink_status = symlink_status(m_path, ec);
}
else if ( &amp;ec != &amp;boost::throws() ) ec.clear();</span></pre>
</blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>
m_symlink_status</code></span></p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool operator==(const directory_entry&amp; rhs);</span></pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path ==
rhs.m_path</code>.</span></p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool operator!=(const directory_entry&amp; rhs);</span></pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path !=
rhs.m_path</code>.</span></p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool operator&lt; (const directory_entry&amp; rhs);</span></pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path &lt;
rhs.m_path</code>.</span></p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool operator&lt;=(const directory_entry&amp; rhs);</span></pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path &lt;=
rhs.m_path</code>.</span></p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool operator&gt; (const directory_entry&amp; rhs);</span></pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path &gt;
rhs.m_path</code>.</span></p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool operator&gt;=(const directory_entry&amp; rhs);</span></pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path &gt;=
rhs.m_path</code>.</span></p>
</blockquote>
<h3><a name="Class-directory_iterator">Class <code>directory_iterator</code></a></h3>
<p>Objects of type <code>directory_iterator</code> provide standard library
compliant iteration over the contents of a directory. Also see class <code>
<a href="#Class-recursive_directory_iterator">recursive_directory_iterator</a></code>.</p>
<pre> namespace boost
{
namespace filesystem
{
class directory_iterator
: public boost::iterator_facade&lt; directory_iterator,
<a href="#Class-directory_entry">directory_entry</a>,
boost::single_pass_traversal_tag &gt;
{
public:
// <a href="#directory_iterator-members">member functions</a>
directory_iterator(); // creates the &quot;end&quot; iterator
directory_iterator(const directory_iterator&amp;);
explicit directory_iterator(const path&amp; p);
directory_iterator(const path&amp; p, system::error_code&amp; ec);
~directory_iterator();
directory_iterator&amp; operator=(const directory_iterator&amp;);
directory_iterator&amp; operator++();
directory_iterator&amp; increment(system::error_code&amp; ec);
// other members as required by
// C++ Std, 24.1.1 Input iterators [input.iterators]
};
} // namespace filesystem
} // namespace boost</pre>
<p> <code>directory_iterator</code> satisfies the requirements of an
input iterator (C++ Std, 24.2.1, Input iterators [input.iterators]).</p>
<p>A <code>directory_iterator</code> reads successive elements from the directory for
which it was constructed, as if by calling <i>POSIX</i>
<code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/readdir_r.html">readdir_r()</a></code>. After a <code>directory_iterator</code> is constructed, and every time
<code>operator++</code> is called,
it reads a directory element and stores information about it in a object of type <code>
<a href="#Class-directory_entry">directory_entry</a></code>.
<code>operator++</code> is not equality preserving; that is, <code>i == j</code> does not imply that
<code>++i == ++j</code>. </p>
<blockquote>
<p>[<i>Note:</i> The practical consequence of not preserving equality is that directory iterators
can only be used for single-pass algorithms. <i>--end note</i>]</p>
</blockquote>
<p>If the end of the directory elements is reached, the iterator becomes equal to
the end iterator value. The constructor <code>directory_iterator()</code>
with no arguments always constructs an end iterator object, which is the only
legitimate iterator to be used for the end condition. The result of <code>
operator*</code> on an end iterator is not defined. For any other iterator value
a <code>const directory_entry&amp;</code> is returned. The result of
<code>operator-&gt;</code> on an end iterator is not defined. For any other iterator value a <code>const directory_entry*</code> is
returned. </p>
<p>Two end iterators are always equal. An end iterator is not equal to a non-end
iterator.</p>
<blockquote>
<p><i><span style="background-color: #E0E0E0">The above wording is based on the
Standard Library's istream_iterator wording.</span></i></p>
</blockquote>
<p>The result of calling the <code>path()</code> member of the <code>
directory_entry</code> object obtained by dereferencing a <code>
directory_iterator</code> is a reference to a <code>path</code>
object composed of the directory argument from which the iterator was
constructed with filename of the directory entry appended as if by <code>
operator/=</code>. </p>
<p>Directory iteration shall not yield directory entries for the current (<i>dot</i>)
and parent (<i>dot dot</i>) directories.</p>
<p>The order of directory entries obtained by dereferencing successive
increments of a <code>directory_iterator</code> is unspecified.</p>
<blockquote>
<p>[<i>Note:</i> Programs performing directory iteration may wish to test if the
path obtained by dereferencing a directory iterator actually exists. It could be
a
symbolic link to a non-existent file. Programs recursively
walking directory trees for purposes of removing and renaming entries may wish
to avoid following symbolic links.</p>
<p>If a file is removed from or added to a directory after the
construction of a <code>directory_iterator</code> for the directory, it is
unspecified whether or not subsequent incrementing of the iterator will ever
result in an iterator whose value is the removed or added directory entry. See
<i>POSIX</i>
<code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/readdir_r.html">readdir_r()</a></code>. <i>
--end note</i>]</p>
</blockquote>
<h4><a name="directory_iterator-members"><code>directory_iterator</code> members</a></h4>
<p><code><a name="directory_iterator-default-ctor">directory_iterator</a>();</code></p>
<blockquote>
<p><i>Effects:</i> Constructs the end iterator.</p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre><code>explicit <a name="directory_iterator-ctor-path">directory_iterator</a>(</code>const path&amp; p<code>);
directory_iterator(</code>const path&amp; p, system::error_code&amp; ec<code>);</code></pre>
<blockquote>
<p><i>Effects:</i> Constructs a iterator representing the first
entry in the directory <code>p</code> resolves to, if any; otherwise, the end iterator.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
<p>[<i>Note:</i> To iterate over the current directory, use <code>
directory_iterator(&quot;.&quot;)</code> rather than <code>directory_iterator(&quot;&quot;)</code>.
<i>-- end note</i>]</p>
</blockquote>
<pre>directory_iterator&amp; <a name="directory_iterator-increment">operator++</a>();
directory_iterator&amp; increment(system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Effects:</i> As specified by the C++ Standard, 24.1.1 Input iterators [input.iterators]</p>
<p><i>Returns:</i> <code>*this</code>.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<h3><a name="Class-recursive_directory_iterator">Class <code>recursive_directory_iterator</code></a></h3>
<p>Objects of type <code>directory_iterator</code> provide standard library
compliant iteration over the contents of a directory, including recursion into
its sub-directories.</p>
<pre> namespace boost
{
namespace filesystem
{
class recursive_directory_iterator :
public iterator&lt;input_iterator_tag, directory_entry &gt;
{
public:
// constructors and destructor
recursive_directory_iterator();
recursive_directory_iterator(const recursive_directory_iterator&amp;);
explicit recursive_directory_iterator(const path&amp; p);
recursive_directory_iterator(const path&amp; p, system::error_code&amp; ec);
~recursive_directory_iterator();
// observers
int level() const;
bool no_push<code>_request</code>() const;
// modifiers
recursive_directory_iterator&amp; operator=(const recursive_directory_iterator&amp;);
recursive_directory_iterator&amp; operator++();
recursive_directory_iterator&amp; increment(system::error_code&amp; ec);
void pop();
void no_push();
// other members as required by
// C++ Std, 24.1.2 Input iterators [input.iterators]
private:
int m_level; <b><i> // for exposition only</i></b>
bool m_no_<code>push_request</code>; <b><i>// for exposition only</i></b>
};
} // namespace filesystem
} // namespace boost</pre>
<p>The behavior of a <code>recursive_directory_iterator</code> is the same
as a <code>directory_iterator</code> unless otherwise specified.</p>
<ul>
<li>When an iterator reaches the end of the directory currently being iterated
over, or when <code>pop()</code> is called, <code>m_level</code> is
decremented, and iteration continues with the parent directory, until the
directory specified in the constructor argument is reached.</li>
</ul>
<blockquote>
<p>[<i>Note:</i> One of the uses of <code>no_push()</code> is to prevent
unwanted recursion into a directory symlink. This may be necessary to
prevent loops on some operating systems. <i>--end note</i>]</p>
</blockquote>
<pre>recursive_directory_iterator();</pre>
<blockquote>
<p><i>Effects:</i> Constructs the end iterator.</p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre><code>explicit </code>recursive_<code>directory_iterator(</code>const path&amp; p<code>);
</code>recursive_<code>directory_iterator(</code>const path&amp; p, system::error_code&amp; ec<code>);</code></pre>
<blockquote>
<p><i>Effects:</i>&nbsp; Constructs a iterator representing the first
entry in the directory <code>p</code> resolves to, if any; otherwise, the end iterator.</p>
<p><i>Postconditions: </i>Unless the end iterator was constructed,<i> </i><code>
level() == 0</code>, <code>no_push_request() == false</code>.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
<p>[<i>Note:</i> To iterate over the current directory, use <code>recursive_directory_iterator(&quot;.&quot;)</code> rather than
<code>recursive_directory_iterator(&quot;&quot;)</code>.
<i>-- end note</i>]</p>
</blockquote>
<pre>int level() const;</pre>
<blockquote>
<p><i>Requires:</i> <code>*this != recursive_directory_iterator()</code>.</p>
<p><i>Returns:</i> <code>m_level</code>.</p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre>bool <code>no_push_request</code>() const;</pre>
<blockquote>
<p><i>Requires:</i> <code>*this != recursive_directory_iterator()</code>.</p>
<p><i>Returns:</i> <code>m_no_push_request</code>.</p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre><code>recursive_directory_iterator</code>&amp; <a name="recursive_directory_iterator-increment">operator++</a>();
recursive_directory_iterator&amp; increment(system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Effects:</i> As specified by the C++ Standard, 24.1.1 Input iterators [input.iterators],
except that if <code>(*this)-&gt;is_directory() &amp;&amp; !no_push_requested()</code> then&nbsp; <code>m_level</code>
is incremented and <code>(*this)-&gt;path()</code> is recursively iterated into.</p>
<p><i>Postconditions:</i> <code>no_push_request() == false</code>.</p>
<p><i>Returns:</i> <code>*this</code>.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre>void pop();</pre>
<blockquote>
<p><i>Requires:</i> <code>*this != recursive_directory_iterator()</code>.</p>
<p><i>Effects:</i> If <code>level() == 0</code>, set <code>*this</code> to <code>recursive_directory_iterator()</code>.
Otherwise, <code>--m_level</code>, cease iteration of the directory currently being
iterated over, and continue iteration over the parent directory.</p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre>void no_push();</pre>
<blockquote>
<p><i>Requires:</i> <code>*this != recursive_directory_iterator()</code>.</p>
<p><i>Postconditions:</i> <code>no_push_request() == true</code>.</p>
<p><i>Throws:</i> Nothing.</p>
<p>[<i>Note:</i> One of the uses of <code>no_push()</code> is to prevent
unwanted recursion into a directory symlink. This may be necessary to
prevent loops on some operating systems. <i>--end note</i>]</p>
</blockquote>
<h3><a name="file_status">Class file_status</a></h3>
<pre> namespace boost
{
namespace filesystem
{
class file_status
{
public:
file_status();
file_status(const file_status&amp;);
explicit file_status(file_type v=status_error);
~file_status();
<a href="#file_type">file_type</a> type() const;
void type(file_type v);
};
} // namespace filesystem
} // namespace boost</pre>
<p>An object of type <code>file_status</code> stores information about the status of a
file. The internal form of the stored information is unspecified.</p>
<blockquote>
<p><i>[Note: </i>The class may be extended in the future to store
additional status information. <i>--end note]</i></p>
</blockquote>
<h4>Members</h4>
<pre>explicit file_status(<a href="#file_type">file_type</a> v=status_error);</pre>
<blockquote>
<p><i>Effects:</i> Stores <code>v</code>.</p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre>file_type type() const;</pre>
<blockquote>
<p><i>Returns: </i>The stored <a href="#file_type"> <code>file_type</code>.</a></p>
</blockquote>
<pre>void type(<a href="#file_type">file_type</a> v);</pre>
<blockquote>
<p><i>Effects:</i> Stores <code>v</code>, replacing the previously stored
value.</p>
</blockquote>
<h3><a name="Operational-functions">Operational functions</a></h3>
<p>Operational functions query or modify files, including directories, in external
storage.</p>
<p style="font-size: 10pt">Operational functions access a file by resolving an
object of class <code>path</code> to a particular file in a file hierarchy. The
path is resolved as if by the <i>POSIX</i>
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap04.html#tag_04_11">
Pathname Resolution</a> mechanism.</p>
<p>[<i>Note: </i>Because hardware failures, network failures,
<a href="#Race-condition">race conditions</a>, and many
other kinds of errors occur frequently in file system operations, users should be aware
that any filesystem operational function, no matter how apparently innocuous, may encounter
an error.&nbsp;See <a href="#Error-reporting">Error reporting</a>. <i>-- end note</i>]</p>
<h4><a name="Function-specifications">Operational function specifications</a></h4>
<pre>path <a name="absolute">absolute</a>(const path&amp; p, const path&amp; base=current_path());</pre>
<blockquote>
<p><i>Returns:</i> A path composed according to to the
following table</p>
<table border="1" cellpadding="5" cellspacing="0" bordercolor="#111111" style="border-collapse: collapse">
<tr>
<td align="center">&nbsp;</td>
<td align="center"><b><code>p.has_root_directory()</code></b></td>
<td align="center"><b><code>!p.has_root_directory()</code></b></td>
</tr>
<tr>
<td align="center"><b><code>p.has_root_name()</code></b></td>
<td align="center"><code>return p</code></td>
<td align="center"><code>return p.root_name() /
absolute(base).root_directory()<br>
/ absolute(base).relative_path() / p.relative_path()</code></td>
</tr>
<tr>
<td align="center"><b><code>!p.has_root_name()</code></b></td>
<td align="center"><code>return absolute(base).root_name()<br>
/ p</code></td>
<td align="center"><code>return absolute(base) / p</code></td>
</tr>
</table>
<p><i>Postconditions:</i> For the returned path, <code>rp,</code> <code>
rp.is_absolute()</code> is true.</p>
<p><i>Throws:</i> If <code>base.is_absolute()</code> is true, throws only if
memory allocation fails.</p>
</blockquote>
<pre>void copy_file(const path&amp; from, const path&amp; to);</pre>
<blockquote>
<p><i>Effects: </i><code>copy_file(from, to,
copy_option::fail_if_exists)</code>.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre>void copy_file(const path&amp; from, const path&amp; to, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Effects: </i><code>copy_file(from, to,
copy_option::fail_if_exists, ec)</code>.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre>void <a name="copy_file">copy_file</a>(const path&amp; from, const path&amp; to, BOOST_SCOPED_ENUM(<a href="#copy_option">copy_option</a>) option);
void <a name="copy_file2">copy_file</a>(const path&amp; from, const path&amp; to, BOOST_SCOPED_ENUM(<a href="#copy_option">copy_option</a>) option, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Effects:</i> If <code>option == copy_option::</code><span style="background-color: #FFFFFF"><code>fail_if_exists
&amp;&amp; exists(to)</code>, an error is reported. Otherwise, t</span>he contents and attributes of the file <code>from</code>
resolves to are copied to the file <code>to</code> resolves to.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre>bool <a name="create_directories">create_directories</a>(const path&amp; p);
bool <a name="create_directories2">create_directories</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Requires:</i> <code>p.empty() || <br>
forall px: px == p || is_parent(px, p): is_directory(px) || !exists( px )</code>
</p>
<p><i>Postconditions:</i> <code>is_directory(p)</code></p>
<p><i>Returns:</i> The value of <code>!exists(p)</code> prior to the
establishment of the postcondition.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre>bool <a name="create_directory">create_directory</a>(const path&amp; p);
bool <a name="create_directory2">create_directory</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Effects:</i> Attempts to create the directory <code>p</code> resolves to,
as if by<i> POSIX </i><code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/mkdir.html">mkdir()</a></code> with a second argument of S_IRWXU|S_IRWXG|S_IRWXO. </p>
<p><i>Postcondition:</i> <code>is_directory(p)</code></p>
<p><i>Returns:</i> <code>true</code> if a new directory was created, otherwise
<code>false</code>.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre><span style="background-color: #FFFFFF">void <a name="create_hard_link">create_hard_link</a>(const path&amp; to, const path&amp; from);
void <a name="create_hard_link2">create_hard_link</a>(const path&amp; to, const path&amp; from, system::error_code&amp; ec);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF"> Establishes the postcondition, as if by
</span> <i><span style="background-color: #FFFFFF">POSIX</span></i><span style="background-color: #FFFFFF">
</span> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/link.html">
<span style="background-color: #FFFFFF">link()</span></a></code><span style="background-color: #FFFFFF">.</span></p>
<p><i><span style="background-color: #FFFFFF">Postconditions:</span></i></p>
<ul>
<li><span style="background-color: #FFFFFF">&nbsp;</span><code><span style="background-color: #FFFFFF">exists(to) &amp;&amp;
exists(from) &amp;&amp; equivalent(to,
from)</span></code></li>
<li><span style="background-color: #FFFFFF">The contents of the file or directory
<code>to</code> resolves to are unchanged.</span></li>
</ul>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
<p><span style="background-color: #FFFFFF">[</span><i><span style="background-color: #FFFFFF">Note:</span></i><span style="background-color: #FFFFFF">
Some <b>operating systems</b> do not support hard links at all or support
them only for regular files. Some <b>file systems</b> do not support hard
links regardless of the operating system - the FAT system used on floppy
discs, memory cards and flash drives, for example. Some file systems limit the
number of links per file. Thus hard links should only be used if these
situations are not concerns, or if workarounds are provided. </span> <i><span style="background-color: #FFFFFF">-- end note</span></i><span style="background-color: #FFFFFF">]</span></p>
</blockquote>
<pre><span style="background-color: #FFFFFF">void <a name="create_symlink">create_symlink</a>(const path&amp; to, const path&amp; from);
void <a name="create_symlink2">create_symlink</a>(const path&amp; to, const path&amp; from, system::error_code&amp; ec);</span></pre>
<blockquote style="font-size: 10pt">
<p style="font-size: 10pt"><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF">
Establishes the postcondition, as if by </span><i>
<span style="background-color: #FFFFFF">POSIX</span></i><span style="background-color: #FFFFFF">
</span><code><span style="background-color: #FFFFFF">
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/symlink.html">
symlink()</a></span></code><span style="background-color: #FFFFFF">.</span></p>
<p style="font-size: 10pt"><span style="background-color: #FFFFFF"><i>
Postconditions:</i> <code>from</code> resolves to a symbolic link file that
contains an unspecified representation of <code>to</code>.</span></p>
<p style="font-size: 10pt"><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
<p><span style="background-color: #FFFFFF">[</span><i><span style="background-color: #FFFFFF">Note:</span></i><span style="background-color: #FFFFFF">
Some <b>operating systems</b> do not support symbolic links at all or support
them only for regular files. Windows prior to Vista, for example, did not
support symbolic links.
Some <b>file systems</b> do not
support
symbolic links regardless of the operating system - the FAT system used on floppy discs, memory cards and flash
drives,
for example. Thus symbolic links should only be used if these situations are
not concerns, or if workarounds are provided. </span> <i><span style="background-color: #FFFFFF">-- end note</span></i><span style="background-color: #FFFFFF">]</span></p>
</blockquote>
<pre>path <a name="current_path">current_path</a>();
path <a name="current_path2">current_path</a>(system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Returns:</i> The current working directory path, as if by <i>POSIX</i>
<code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/getcwd.html">
getcwd()</a></code>. <code>is_absolute()</code> is true for the returned path.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
<p>[<i>Note: </i>The <code>
current_path()</code> name was chosen to emphasize that the return is a
path, not just a single directory name.</p>
<p>The current path as returned by many operating systems is a dangerous
global variable. It may be changed unexpectedly by a third-party or system
library functions, or by another thread.&nbsp; <i>-- end note</i>]</p>
</blockquote>
<pre>void current_path(const path&amp; p);
void current_path(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p style="font-size: 10pt"><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF">
Establishes the postcondition, as if by </span><i>
<span style="background-color: #FFFFFF">POSIX</span></i><span style="background-color: #FFFFFF">
</span><code><span style="background-color: #FFFFFF">
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/chdir.html">
chdir()</a></span></code><span style="background-color: #FFFFFF">.</span></p>
<p><i>Postconditions:</i> <code>equivalent(p, current_path())</code>.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
<p>[<i>Note: </i>The current path for many operating systems is a dangerous
global state. It may be changed unexpectedly by a third-party or system
library functions, or by another thread.&nbsp; <i>-- end note</i>]</p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool <a name="exists">exists</a>(file_status s);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
<code>status_known(s) &amp;&amp; s.type() != file_not_found</code></span></p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre>bool <a name="exists2">exists</a>(const path&amp; p);
bool <a name="exists3">exists</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Returns:</i> <code>exists(status(p))</code> or <code>exists(status(p, ec))</code>,
respectively.</p>
<p><i>Throws:</i> <code>filesystem_error</code>; overload with <code>error_code&amp;</code> throws
nothing.</p>
</blockquote>
<pre><code>bool <a name="equivalent">equivalent</a>(const path&amp; p1, const path&amp; p2);
bool <a name="equivalent2">equivalent</a>(const path&amp; p1, const path&amp; p2, system::error_code&amp; ec);</code></pre>
<blockquote style="font-size: 10pt">
<p style="font-size: 10pt"><i>Effects:</i> Determines <code>file_status s1</code>
and <code>s2</code>, as if by <code>status(p1)</code> and&nbsp; <code>status(p2)</code>,
respectively.</p>
<p style="font-size: 10pt"><i>Returns:</i> <code>true</code>, if <code>sf1 ==
sf2</code> and <code>p1</code> and <code>p2</code> resolve to the same file
system entity, else <code>false</code>.</p>
<blockquote>
<p style="font-size: 10pt">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. This is determined as if by the values of the <i>POSIX</i>
<code>
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html">
stat</a></code> structure<code>,</code> obtained as if by <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">
stat()</a></code> for the two paths, having equal <code>st_dev</code> values
and equal <code>st_ino</code> values.</p>
<p style="font-size: 10pt">[<i>Note:</i> <i>POSIX</i> requires that <i>&quot;st_dev</i>
must be unique within a Local Area Network&quot;. Conservative <i>POSIX</i>
implementations may also wish to check for equal <code>st_size</code> and
<code>st_mtime</code> values. <i>Windows</i> implementations may use <code>
GetFileInformationByHandle()</code> as a surrogate for <code>stat()</code>,
and consider &quot;same&quot; to be equal values for <code>dwVolumeSerialNumber</code>,
<code>nFileIndexHigh</code>, <code>nFileIndexLow</code>, <code>nFileSizeHigh</code>,
<code>nFileSizeLow</code>, <code>ftLastWriteTime.dwLowDateTime</code>, and
<code>ftLastWriteTime.dwHighDateTime</code>. <i>-- end note</i>]</p>
</blockquote>
<p style="font-size: 10pt"><i>Throws:</i> <code>filesystem_error</code><span style="background-color: #FFFFFF">
</span>if <code>(!exists(s1) &amp;&amp; !exists(s2)) || (is_other(s1) &amp;&amp; is_other(s2))</code>,
otherwise as specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre><span style="background-color: #FFFFFF; ">uintmax_t</span> <a name="file_size">file_size</a>(const path&amp; p);<span style="background-color: #FFFFFF; ">
uintmax_t</span> <a name="file_size2">file_size</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p><span style="background-color: #FFFF00">Remarks: </span></p>
<p><i>Returns:</i> If <code>exists(p) &amp;&amp; is_regular_file(p)</code>, the size
<span style="background-color: #FFFFFF; ">in bytes</span>
of the file <code>p</code> resolves to, determined as if by the value of
the <i>POSIX</i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html">stat</a></code> structure member <code>st_size</code>
obtained as if by <i>POSIX</i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">stat()</a></code>.
Otherwise, <code>static_cast&lt;uintmax_t&gt;(-1)</code>.</p>
<p style="font-size: 10pt"><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool </span><code><span style="background-color: #FFFFFF"><a name="is_directory">is_directory</a></span></code><span style="background-color: #FFFFFF">(file_status s);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF"> </span>
<code><span style="background-color: #FFFFFF">s.type() == directory_file</span></code></p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre><code>bool <a name="is_directory2">is_directory</a>(const path&amp; p);
bool <a name="is_directory3">is_directory</a>(const path&amp; p, system::error_code&amp; ec);</code></pre>
<blockquote>
<p dir="ltr"><i>Returns:</i> <code>is_directory(status(p))</code> or <code>is_directory(status(p, ec))</code>,
respectively.</p>
<p><i>Throws:</i> <code>filesystem_error</code>; overload with <code>error_code&amp;</code> throws
nothing.</p>
</blockquote>
<pre><code>bool <a name="is_empty">is_empty</a>(const path&amp; p);
bool <a name="is_empty2">is_empty</a></a>(const path&amp; p, system::error_code&amp; ec);</code></pre>
<blockquote>
<p><i>Effects:</i> Determines <code>file_status s</code>, as if by <code>
status(p, ec)</code>.</p>
<p><i>Returns:</i> <code>is_directory(s)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ?
directory_iterator(p) == directory_iterator()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : file_size(p) == 0;</code></p>
</blockquote>
<pre>bool <code><a name="is_regular_file">is_regular_file</a></code>(file_status s);</pre>
<blockquote>
<p><i>Returns:</i>
<code>s.type() == regular_file</code></p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre><code>bool <a name="is_regular_file2">is_regular_file</a>(const path&amp; p);</code></pre>
<blockquote>
<p><i>Returns:</i> <code>is_regular_file(status(p))</code>.</p>
<p><i>Throws:</i> <code>filesystem_error</code>
if <code>status(p)</code> would throw <code>filesystem_error.</code></p>
</blockquote>
<pre><code>bool <a name="is_regular_file3">is_regular_file</a>(const path&amp; p, system::error_code&amp; ec);</code></pre>
<blockquote>
<p><i>Effects:</i> Sets <code>ec</code> as if by <code>status(p, ec)</code>. [<i>Note:</i>
<code>status_error</code>,
<code>file_not_found</code>
and
<code>type_unknown</code>
cases set <code>ec</code>
to error values. To distinguish between cases, call the <code>
status</code>
function directly. <i>-- end
note</i>] </p>
<p><i>Returns:</i> <code>is_regular_file(status(p, ec))</code>.</p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool <a name="is_other">is_other</a>(file_status s);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
<code>return exists(s) &amp;&amp; !is_regular_file(s) &amp;&amp; !is_directory(s) &amp;&amp; !is_symlink(s)</code></span></p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre><code>bool <a name="is_other2">is_other</a>(const path&amp; p);
bool <a name="is_other3">is_other</a>(const path&amp; p, system::error_code&amp; ec);</code></pre>
<blockquote>
<p><i>Returns:</i> <code>is_other(status(p))</code> or <code>is_other(status(p, ec))</code>,
respectively.</p>
<p><i>Throws:</i> <code>filesystem_error</code>; overload with <code>error_code&amp;</code> throws
nothing.</p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool <a name="is_symlink">is_symlink</a>(file_status s);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF"> </span>
<code><span style="background-color: #FFFFFF">s.type() == symlink_file</span></code></p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre><code>bool <a name="is_symlink2">is_symlink</a>(const path&amp; p);
bool <a name="is_symlink3">is_symlink</a>(const path&amp; p, system::error_code&amp; ec);</code></pre>
<blockquote>
<p><i>Returns:</i> <code>is_symlink(symlink_status(p))</code> or <code>is_symlink(symlink_status(p, ec))</code>,
respectively.</p>
<p><i>Throws:</i> <code>filesystem_error</code>; overload with <code>error_code&amp;</code> throws
nothing.</p>
</blockquote>
<pre>std::time_t <a name="last_write_time">last_write_time</a>(const path&amp; p);
std::time_t <a name="last_write_time2">last_write_time</a>(const path&amp; p<code>, system::error_code&amp; ec</code>);</pre>
<blockquote>
<p><i>Returns:</i> The time of last data modification of <code>p</code>, determined as if by the
value of the <i>POSIX</i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html">stat</a></code> structure member <code>st_mtime</code>&nbsp; obtained
as if by <i>POSIX</i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">stat()</a></code>.</p>
</blockquote>
<pre>void <a name="last_write_time3">last_write_time</a>(const path&amp; p, const std::time_t new_time);
void <a name="last_write_time4">last_write_time</a>(const path&amp; p, const std::time_t new_time<code>, system::error_code&amp; ec</code>);</pre>
<blockquote>
<p><i>Effects:</i> Sets the time of last data modification of the file
resolved to by <code>p</code>
to <code>new_time</code>, as if by <i>POSIX</i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">stat()</a></code>
followed by <i>POSIX</i>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/utime.html">
<code>utime()</code></a>.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
<p>[<i>Note:</i> A postcondition of <code>last_write_time(p) ==
new_time</code> is not specified since it might not hold for file systems
with coarse time granularity. <i>-- end note</i>]</p>
</blockquote>
<pre>path <a name="read_symlink">read_symlink</a>(const path&amp; p);
path read_symlink(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p dir="ltr"><i>Returns:</i>&nbsp; If <code>p</code> resolves to a symbolic
link, a <code>path</code> object containing the contents of that symbolic
link. Otherwise an empty <code>path</code> object.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>. [<i>Note:</i> It is an error if <code>p</code> does not
resolve to a symbolic link. <i>-- end note</i>]</p>
</blockquote>
<pre>bool <a name="remove">remove</a>(const path&amp; p);
bool <a name="remove2">remove</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Effects:</i>&nbsp; If <code>exists(symlink_status(p,ec))</code>, it is
removed
as if by<i> POSIX </i><code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/remove.html">remove()</a></code>.</p>
<blockquote>
<p>[<i>Note:</i> A symbolic link is itself removed, rather than the file it
resolves to being removed. <i>-- end note</i>]</p>
</blockquote>
<p><i>Postcondition:</i> <code>!exists(symlink_status(p))</code>.</p>
<p><i>Returns:</i>&nbsp; <code>false</code> if p did not exist in the first
place, otherwise <code>true</code>.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre>uintmax_t <a name="remove_all">remove_all</a>(const path&amp; p);
uintmax_t <a name="remove_all2">remove_all</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Effects:</i>&nbsp; Recursively deletes the contents of p if it exists,
then deletes file <code>p</code> itself,
as if by<i> POSIX </i><code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/remove.html">remove()</a></code>.</p>
<blockquote>
<p>[<i>Note:</i> A symbolic link is itself removed, rather than the file it
resolves to being removed. <i>-- end note</i>]</p>
</blockquote>
<p><i>Postcondition:</i> <code>!exists(p)</code></p>
<p><i>Returns:</i> The number of files removed.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre>void <a name="rename">rename</a>(const path&amp; old_p, const path&amp; new_p);
void <a name="rename2">rename</a>(const path&amp; old_p, const path&amp; new_p, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Effects:</i> Renames <code>old_p</code> to <code>new_p</code>, as if by
<i>POSIX</i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/rename.html">
rename()</a></code>.</p>
<blockquote>
<p>[<i>Note:</i> If <code>old_p</code> and <code>new_p</code> resolve to the
same existing file, no action is taken. Otherwise, if <code>new_p</code> resolves to an
existing non-directory file, it is removed, while if <code>new_p</code> resolves to an
existing directory, it is removed if empty on POSIX but is an error on Windows. A symbolic link is itself renamed, rather than
the file it resolves to being renamed. <i>-- end note</i>]</p>
</blockquote>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre>void <a name="resize_file">resize_file</a>(const path&amp; p, <span style="background-color: #FFFFFF; ">uintmax_t new_size</span>);
void <a name="resize_file2">resize_file</a>(const path&amp; p, <span style="background-color: #FFFFFF; ">uintmax_t new_size, </span>system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Postconditions:</i> <code>file_size() == new_size</code>.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
<p style="font-size: 10pt"><i>Remarks:</i> Achieves its postconditions as if by
POSIX <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/truncate.html">
truncate()</a></code>.</p>
</blockquote>
<pre><span style="background-color: #FFFFFF">space_info <a name="space">space</a>(const path&amp; p);
space_info <a name="space2">space</a>(const path&amp; p</span>, system::error_code&amp; ec<span style="background-color: #FFFFFF">);</span></pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> An object of type <code>
<a href="#space_info">space_info</a></code>. The value of the <code>space_info</code> object is determined as if by
using </span> <i><span style="background-color: #FFFFFF">POSIX</span></i><span style="background-color: #FFFFFF"> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/statvfs.html" style="text-decoration: none">
statvfs()</a></code> to obtain a <i>POSIX</i> struct <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/statvfs.h.html" style="text-decoration: none">
statvfs</a></code>, and then multiplying its <code>f_blocks</code>, <code>
f_bfree</code>, and <code>f_bavail</code> members by its <code>f_frsize</code>
member, and assigning the results to the <code>capacity</code>, <code>free</code>,
and <code>available</code> members respectively. Any members for which the
value cannot be determined shall be set to -1.</span></p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
<pre><a href="#file_status">file_status</a> <a name="status">status</a>(const path&amp; p);</pre>
<blockquote>
<p><i>Effects: </i>As if:</p>
<blockquote>
<pre>system::error_code ec;
file_status result = status(p, ec);
if (result == status_error)
throw filesystem_error(<i>implementation-supplied-message</i>, p, ec);
return result;</pre>
</blockquote>
<p><i>Returns:</i> See above.</p>
<p><i>Throws:</i> <code>filesystem_error</code>.
[<i>Note:</i> <code>result</code> values of <code>
file_status(file_not_found)</code>and <code>
file_status(type_unknown)</code> are not considered failures and do not
cause an exception to be
thrown.<i> -- end note</i>] </p>
</blockquote>
<pre><a href="#file_status">file_status</a> <a name="status2">status</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Effects: </i></p>
<blockquote>
<p>If possible, determines the attributes
of the file
<code>p</code> resolves to, as if by<i> POSIX </i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">stat()</a></code>.</p>
If, during attribute determination, the underlying file system API reports
an error, sets <code>ec</code> to indicate the specific error reported.
Otherwise, <code>ec.clear()</code>.<blockquote>
<p>[<i>Note:</i> This allows users to inspect the specifics of underlying
API errors even when the value returned by <code>status()</code> is not <code>
file_status(status_error)</code>.&nbsp; <i>--end note</i>]</p>
</blockquote>
</blockquote>
<p><i>Returns:</i></p>
<blockquote>
<p>If <code>ec != error_code()</code>:</p>
<ul>
<li>If the specific error indicates that <code>p</code> cannot be resolved
because some element of the path does not exist, return <code>
file_status(file_not_found)</code>. [<i>Note:</i> POSIX errors that
indicate this are ENOENT or ENOTDIR. Windows equivalents
include ERROR_FILE_NOT_FOUND, ERROR_PATH_NOT_FOUND, ERROR_INVALID_NAME,
ERROR_INVALID_PARAMETER, ERROR_BAD_PATHNAME, and ERROR_BAD_NETPATH. <i>--
end note</i>]<br>
&nbsp;</li>
<li>Otherwise, if the specific error indicates that <code>p</code> can be resolved
but the attributes cannot be determined, return <code>
file_status(type_unknown)</code>. [<i>Note: </i>For example, Windows
ERROR_SHARING_VIOLATION errors. For POSIX, the case never arises. <i>-- end
note</i>]<br>
&nbsp;</li>
<li>Otherwise, return <code>
file_status(status_error)</code>.</li>
</ul>
<blockquote>
<p>[<i>Note:</i> These semantics distinguish between
<code>p</code> being known not to exist,
<code>p</code> existing but not being able to determine its attributes,
and there being an error that prevents even knowing if
<code>p</code> exists. These
distinctions are important to some use cases.&nbsp;<i>--end note</i>]</p>
</blockquote>
<p>Otherwise,</p>
<ul>
<li>If the attributes indicate a regular file, as if by <i>POSIX</i>&nbsp;<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html">S_ISREG()</a>,
return <code>
file_status(regular_file)</code>. [<i>Note:</i> <code>
regular_file</code> implies appropriate <code>&lt;fstream&gt;</code> operations
would succeed, assuming no hardware, permission, access, or race condition
errors. Lack of
<code>regular_file</code> does not necessarily imply <code>&lt;fstream&gt;</code> operations would
fail on a directory.
<i>-- end note</i>]<br>
&nbsp;</li>
<li>Otherwise, if the attributes indicate a directory, as if by <i>POSIX</i>
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html">S_ISDIR()</a>,
return <code>
file_status(directory_file)</code>. [<i>Note:</i> <code>directory_file</code> implies <code>
directory_iterator(p)</code>would succeed.
<i>-- end note</i>]<br>
&nbsp;</li>
<li>Otherwise, if the attributes indicate a block special file, as if by <i>POSIX</i>
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html">S_ISBLK()</a>,
return <code>
file_status(block_file)</code>.<br>
&nbsp;</li>
<li>Otherwise, if the attributes indicate a character special file, as if by <i>POSIX</i>
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html">S_ISCHR()</a>,
return <code>
file_status(character_file)</code>.<br>
&nbsp;</li>
<li>Otherwise, if the attributes indicate a fifo or pipe file, as if by <i>POSIX</i>
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html">S_ISFIFO()</a>,
return <code>
file_status(fifo_file)</code>.<br>
&nbsp;</li>
<li>Otherwise, if the attributes indicate a socket, as if by <i>POSIX</i>
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html">S_ISSOCK()</a>,
return <code>
file_status(socket_file)</code>.<br>
&nbsp;</li>
<li>Otherwise, return <code>
file_status(type_unknown)</code>.</li>
</ul>
</blockquote>
<p><i>Throws:</i> Nothing.</p>
<p><i>Remarks:</i> If a symbolic link is encountered during pathname
resolution,
pathname resolution continues using the contents of the symbolic link.</p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool <a name="status_known">status_known</a>(file_status s);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
<code>s.type() != status_error</code></span></p>
<p><i>Throws:</i> Nothing.</p>
</blockquote>
<pre>file_status <a name="symlink_status">symlink_status</a>(const path&amp; p);
file_status <a name="symlink_status2">symlink_status</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Effects:</i>&nbsp; Same as <a href="#status">status()</a>, above,
except that the attributes
of
<code>p</code> are determined as if by<i> POSIX </i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/lstat.html">
lstat()</a></code>.</p>
</blockquote>
<blockquote>
<p><i>Returns:</i> Same as <a href="#status">status()</a>, above, except
that if the attributes indicate a symbolic link, as if by <i>POSIX</i>
<a class="external" href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html">
S_ISLNK()</a>, return <code>file_status(symlink_file)</code>.</p>
<p><i>Throws:</i> Nothing.</p>
<p><i>Remarks:</i> Pathname resolution terminates if <code>p</code> names a symbolic link.</p>
</blockquote>
<pre>path <a name="system_complete">system_complete</a>(const path&amp; p);
path <a name="system_complete2">system_complete</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Effects:</i> Composes an absolute path from <code>p</code>, using the
same rules used by the operating system to resolve a path passed as the
filename argument to standard library open functions.</p>
<p><i>Returns:</i> The composed path.</p>
<p><i>Postconditions:</i> For the returned path, <code>rp,</code> <code>
rp.is_absolute()</code> is true.</p>
<p>[<i>Note:</i> For <i>POSIX</i>, <code>system_complete(p)</code> has the same semantics as
<code>complete(p, current_path())</code>.</p>
<p><a name="windows_effects">For <i>Windows</i></a>, <code>system_complete(p)</code> has the
same semantics as <code>complete(ph, current_path())</code> if
<code>p.is_absolute() || !p.has_root_name()</code> or <code>p</code> and <code>base</code> have the same
<code>root_name()</code>.
Otherwise it acts like <code>complete(p, kinky)</code>, where <code>kinky</code>
is the current directory for the <code>p.root_name()</code> drive. This will
be the current directory of that drive the last time it was set, and thus may
be <b>residue left over from a prior program</b> run by the command
processor! Although these semantics are often useful, they are also very
error-prone.</p>
<p>See <a href="#complete_note">
<i>complete()</i> note</a> for usage suggestions. <i>-- end note</i>]</p>
</blockquote>
<pre>path <a name="unique_path">unique_path</a>(const path&amp; model=&quot;%%%%-%%%%-%%%%-%%%%&quot;);
path unique_path(const path&amp; model, system::error_code&amp; ec);</pre>
<blockquote>
<p>The <code>unique_path</code> function generates a path name suitable for
creating temporary files, including directories. The name is based
on a model that uses the percent sign character to specify replacement by a
random hexadecimal digit. [<i>Note:</i> The more bits of randomness in the
generated path name, the less likelihood of prior existence or being guessed.
Each replacement hexadecimal digit in the model adds four bits of randomness.
The default model thus provides 64 bits of randomness. This is sufficient for
most applications. <i>--end note</i>]</p>
<p><i>Returns:</i> A path identical to <code>model</code>, except that each
occurrence of a percent sign character is replaced by a random hexadecimal
digit character in the range 0-9, a-f.</p>
<p><i>Throws:</i> As specified in
<a href="#Error-reporting">
Error reporting</a>.</p>
<p><i>Remarks:</i> Implementations are encouraged to obtain the required
randomness via a
<a href="http://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator">
cryptographically secure pseudo-random number generator</a>, such as one
provided by the operating system. [<i>Note</i>: Such generators may block
until sufficient entropy develops. <i>--end note</i>]</p>
</blockquote>
<h3><a name="File-streams">File streams</a> -
<a href="../../../../boost/filesystem/fstream.hpp">&lt;boost/filesystem/fstream.hpp&gt;</a></h3>
<p>Replacements are provided for the file stream classes from the C++ standard
library's <code>&lt;fstream&gt;</code> header. These replacement classes
publicly inherit from the standard library classes. In the Boost.Filesystem
version, constructors and open functions take <code>const path&amp;</code> arguments
instead of <code>
const char*</code> arguments. There are no other differences in syntax or
semantics.</p>
<pre>namespace boost
{
namespace filesystem
{
template &lt; class charT, class traits = std::char_traits&lt;charT&gt; &gt;
class basic_filebuf : public std::basic_filebuf&lt;charT,traits&gt;
{
public:
basic_filebuf&lt;charT,traits&gt;*
open(const path&amp; p, std::ios_base::openmode mode);
};
template &lt; class charT, class traits = std::char_traits&lt;charT&gt; &gt;
class basic_ifstream : public std::basic_ifstream&lt;charT,traits&gt;
{
public:
explicit basic_ifstream(const path&amp; p, std::ios_base::openmode mode=std::ios_base::in)
void open(const path&amp; p, std::ios_base::openmode mode=std::ios_base::in);
};
template &lt; class charT, class traits = std::char_traits&lt;charT&gt; &gt;
class basic_ofstream : public std::basic_ofstream&lt;charT,traits&gt;
{
public:
explicit basic_ofstream(const path&amp; p, std::ios_base::openmode mode=std::ios_base::out);
void open(const path&amp; p, std::ios_base::openmode mode=std::ios_base::out);
};
template &lt; class charT, class traits = std::char_traits&lt;charT&gt; &gt;
class basic_fstream : public std::basic_fstream&lt;charT,traits&gt;
{
public:
explicit basic_fstream(const path&amp; p,
std::ios_base::openmode mode=std::ios_base::in | std::ios_base::out);
void open(const path&amp; p,
std::ios_base::openmode mode=std::ios_base::in | std::ios_base::out);
};
typedef basic_filebuf&lt;char&gt; filebuf;
typedef basic_ifstream&lt;char&gt; ifstream;
typedef basic_ofstream&lt;char&gt; ofstream;
typedef basic_fstream&lt;char&gt; fstream;
typedef basic_filebuf&lt;wchar_t&gt; wfilebuf;
typedef basic_ifstream&lt;wchar_t&gt; wifstream;
typedef basic_fstream&lt;wchar_t&gt; wfstream;
typedef basic_ofstream&lt;wchar_t&gt; wofstream;
} // namespace filesystem
} // namespace boost</pre>
<h2><a name="Path-decomposition-table">Path decomposition table</a></h2>
<p>The table is generated by a program compiled with the Boost implementation.</p>
<p>Shaded entries indicate cases where <i>POSIX</i> and <i>Windows</i>
implementations yield different results. The top value is the
<i>POSIX</i> result and the bottom value is the <i>Windows</i> result. <br>
&nbsp;<table border="1" cellspacing="0" cellpadding="5">
<p>
<tr><td><b><font size="2">Constructor<br>argument</font></b></td>
<td><b><font size="2">Iteration<br>over<br>Elements</font></b></td>
<td><b><code>string()</code></b></td>
<td><b><code>generic_<br>string()</code></b></td>
<td><b><code>root_<br>path()</code></b></td>
<td><b><code>root_<br>name()</code></b></td>
<td><b><code>root_<br>directory()</code></b></td>
<td><b><code>relative_<br>path()</code></b></td>
<td><b><code>parent_<br>path()</code></b></td>
<td><b><code>filename()</code></b></td>
</tr>
<tr>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
</tr>
<tr>
<td><code>.</code></td>
<td><code>.</code></td>
<td><code>.</code></td>
<td><code>.</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>.</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>..</code></td>
<td><code>..</code></td>
<td><code>..</code></td>
<td><code>..</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>..</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>..</code></td>
</tr>
<tr>
<td><code>foo</code></td>
<td><code>foo</code></td>
<td><code>foo</code></td>
<td><code>foo</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>foo</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>foo</code></td>
</tr>
<tr>
<td><code>/</code></td>
<td><code>/</code></td>
<td><code>/</code></td>
<td><code>/</code></td>
<td><code>/</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>/</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>/</code></td>
</tr>
<tr>
<td><code>/foo</code></td>
<td><code>/,foo</code></td>
<td><code>/foo</code></td>
<td><code>/foo</code></td>
<td><code>/</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>/</code></td>
<td><code>foo</code></td>
<td><code>/</code></td>
<td><code>foo</code></td>
</tr>
<tr>
<td><code>foo/</code></td>
<td><code>foo,.</code></td>
<td><code>foo/</code></td>
<td><code>foo/</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>foo/</code></td>
<td><code>foo</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>/foo/</code></td>
<td><code>/,foo,.</code></td>
<td><code>/foo/</code></td>
<td><code>/foo/</code></td>
<td><code>/</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>/</code></td>
<td><code>foo/</code></td>
<td><code>/foo</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>foo/bar</code></td>
<td><code>foo,bar</code></td>
<td><code>foo/bar</code></td>
<td><code>foo/bar</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>foo/bar</code></td>
<td><code>foo</code></td>
<td><code>bar</code></td>
</tr>
<tr>
<td><code>/foo/bar</code></td>
<td><code>/,foo,bar</code></td>
<td><code>/foo/bar</code></td>
<td><code>/foo/bar</code></td>
<td><code>/</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>/</code></td>
<td><code>foo/bar</code></td>
<td><code>/foo</code></td>
<td><code>bar</code></td>
</tr>
<tr>
<td><code>//net</code></td>
<td><code>//net</code></td>
<td><code>//net</code></td>
<td><code>//net</code></td>
<td><code>//net</code></td>
<td><code>//net</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>//net</code></td>
</tr>
<tr>
<td><code>//net/foo</code></td>
<td><code>//net,/,foo</code></td>
<td><code>//net/foo</code></td>
<td><code>//net/foo</code></td>
<td><code>//net/</code></td>
<td><code>//net</code></td>
<td><code>/</code></td>
<td><code>foo</code></td>
<td><code>//net/</code></td>
<td><code>foo</code></td>
</tr>
<tr>
<td><code>///foo///</code></td>
<td><code>/,foo,.</code></td>
<td><code>///foo///</code></td>
<td><code>///foo///</code></td>
<td><code>/</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>/</code></td>
<td><code>foo///</code></td>
<td><code>///foo</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>///foo///bar</code></td>
<td><code>/,foo,bar</code></td>
<td><code>///foo///bar</code></td>
<td><code>///foo///bar</code></td>
<td><code>/</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>/</code></td>
<td><code>foo///bar</code></td>
<td><code>///foo</code></td>
<td><code>bar</code></td>
</tr>
<tr>
<td><code>/.</code></td>
<td><code>/,.</code></td>
<td><code>/.</code></td>
<td><code>/.</code></td>
<td><code>/</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>/</code></td>
<td><code>.</code></td>
<td><code>/</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>./</code></td>
<td><code>.,.</code></td>
<td><code>./</code></td>
<td><code>./</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>./</code></td>
<td><code>.</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>/..</code></td>
<td><code>/,..</code></td>
<td><code>/..</code></td>
<td><code>/..</code></td>
<td><code>/</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>/</code></td>
<td><code>..</code></td>
<td><code>/</code></td>
<td><code>..</code></td>
</tr>
<tr>
<td><code>../</code></td>
<td><code>..,.</code></td>
<td><code>../</code></td>
<td><code>../</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>../</code></td>
<td><code>..</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>foo/.</code></td>
<td><code>foo,.</code></td>
<td><code>foo/.</code></td>
<td><code>foo/.</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>foo/.</code></td>
<td><code>foo</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>foo/..</code></td>
<td><code>foo,..</code></td>
<td><code>foo/..</code></td>
<td><code>foo/..</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>foo/..</code></td>
<td><code>foo</code></td>
<td><code>..</code></td>
</tr>
<tr>
<td><code>foo/./</code></td>
<td><code>foo,.,.</code></td>
<td><code>foo/./</code></td>
<td><code>foo/./</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>foo/./</code></td>
<td><code>foo/.</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>foo/./bar</code></td>
<td><code>foo,.,bar</code></td>
<td><code>foo/./bar</code></td>
<td><code>foo/./bar</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>foo/./bar</code></td>
<td><code>foo/.</code></td>
<td><code>bar</code></td>
</tr>
<tr>
<td><code>foo/..</code></td>
<td><code>foo,..</code></td>
<td><code>foo/..</code></td>
<td><code>foo/..</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>foo/..</code></td>
<td><code>foo</code></td>
<td><code>..</code></td>
</tr>
<tr>
<td><code>foo/../</code></td>
<td><code>foo,..,.</code></td>
<td><code>foo/../</code></td>
<td><code>foo/../</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>foo/../</code></td>
<td><code>foo/..</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>foo/../bar</code></td>
<td><code>foo,..,bar</code></td>
<td><code>foo/../bar</code></td>
<td><code>foo/../bar</code></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>foo/../bar</code></td>
<td><code>foo/..</code></td>
<td><code>bar</code></td>
</tr>
<tr>
<td><code>c:</code></td>
<td><code>c:</code></td>
<td><code>c:</code></td>
<td><code>c:</code></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><font size="-1"><i>empty</i></font></td>
<td><span style="background-color: #CCFFCC"><code>c:</code><br><font size="-1"><i>empty</i></font></span></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>c:</code></td>
</tr>
<tr>
<td><code>c:/</code></td>
<td><span style="background-color: #CCFFCC"><code>c:,.</code><br><code>c:,/</code></span></td>
<td><code>c:/</code></td>
<td><code>c:/</code></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:/</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>/</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:/</code><br><font size="-1"><i>empty</i></font></span></td>
<td><code>c:</code></td>
<td><span style="background-color: #CCFFCC"><code>.</code><br><code>/</code></span></td>
</tr>
<tr>
<td><code>c:foo</code></td>
<td><span style="background-color: #CCFFCC"><code>c:foo</code><br><code>c:,foo</code></span></td>
<td><code>c:foo</code></td>
<td><code>c:foo</code></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><font size="-1"><i>empty</i></font></td>
<td><span style="background-color: #CCFFCC"><code>c:foo</code><br><code>foo</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:foo</code><br><code>foo</code></span></td>
</tr>
<tr>
<td><code>c:/foo</code></td>
<td><span style="background-color: #CCFFCC"><code>c:,foo</code><br><code>c:,/,foo</code></span></td>
<td><code>c:/foo</code></td>
<td><code>c:/foo</code></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:/</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>/</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:/foo</code><br><code>foo</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:</code><br><code>c:/</code></span></td>
<td><code>foo</code></td>
</tr>
<tr>
<td><code>c:foo/</code></td>
<td><span style="background-color: #CCFFCC"><code>c:foo,.</code><br><code>c:,foo,.</code></span></td>
<td><code>c:foo/</code></td>
<td><code>c:foo/</code></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><font size="-1"><i>empty</i></font></td>
<td><span style="background-color: #CCFFCC"><code>c:foo/</code><br><code>foo/</code></span></td>
<td><code>c:foo</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>c:/foo/</code></td>
<td><span style="background-color: #CCFFCC"><code>c:,foo,.</code><br><code>c:,/,foo,.</code></span></td>
<td><code>c:/foo/</code></td>
<td><code>c:/foo/</code></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:/</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>/</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:/foo/</code><br><code>foo/</code></span></td>
<td><code>c:/foo</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>c:/foo/bar</code></td>
<td><span style="background-color: #CCFFCC"><code>c:,foo,bar</code><br><code>c:,/,foo,bar</code></span></td>
<td><code>c:/foo/bar</code></td>
<td><code>c:/foo/bar</code></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:/</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>/</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:/foo/bar</code><br><code>foo/bar</code></span></td>
<td><code>c:/foo</code></td>
<td><code>bar</code></td>
</tr>
<tr>
<td><code>prn:</code></td>
<td><code>prn:</code></td>
<td><code>prn:</code></td>
<td><code>prn:</code></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>prn:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>prn:</code></span></td>
<td><font size="-1"><i>empty</i></font></td>
<td><span style="background-color: #CCFFCC"><code>prn:</code><br><font size="-1"><i>empty</i></font></span></td>
<td><font size="-1"><i>empty</i></font></td>
<td><code>prn:</code></td>
</tr>
<tr>
<td><code>c:\</code></td>
<td><span style="background-color: #CCFFCC"><code>c:\</code><br><code>c:,/</code></span></td>
<td><code>c:\</code></td>
<td><span style="background-color: #CCFFCC"><code>c:\</code><br><code>c:/</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:\</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>\</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:\</code><br><font size="-1"><i>empty</i></font></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:\</code><br><code>\</code></span></td>
</tr>
<tr>
<td><code>c:foo</code></td>
<td><span style="background-color: #CCFFCC"><code>c:foo</code><br><code>c:,foo</code></span></td>
<td><code>c:foo</code></td>
<td><code>c:foo</code></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><font size="-1"><i>empty</i></font></td>
<td><span style="background-color: #CCFFCC"><code>c:foo</code><br><code>foo</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:foo</code><br><code>foo</code></span></td>
</tr>
<tr>
<td><code>c:\foo</code></td>
<td><span style="background-color: #CCFFCC"><code>c:\foo</code><br><code>c:,/,foo</code></span></td>
<td><code>c:\foo</code></td>
<td><span style="background-color: #CCFFCC"><code>c:\foo</code><br><code>c:/foo</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:\</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>\</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:\foo</code><br><code>foo</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:\</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:\foo</code><br><code>foo</code></span></td>
</tr>
<tr>
<td><code>c:foo\</code></td>
<td><span style="background-color: #CCFFCC"><code>c:foo\</code><br><code>c:,foo,.</code></span></td>
<td><code>c:foo\</code></td>
<td><span style="background-color: #CCFFCC"><code>c:foo\</code><br><code>c:foo/</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><font size="-1"><i>empty</i></font></td>
<td><span style="background-color: #CCFFCC"><code>c:foo\</code><br><code>foo\</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:foo</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:foo\</code><br><code>.</code></span></td>
</tr>
<tr>
<td><code>c:\foo\</code></td>
<td><span style="background-color: #CCFFCC"><code>c:\foo\</code><br><code>c:,/,foo,.</code></span></td>
<td><code>c:\foo\</code></td>
<td><span style="background-color: #CCFFCC"><code>c:\foo\</code><br><code>c:/foo/</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:\</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>\</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:\foo\</code><br><code>foo\</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:\foo</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:\foo\</code><br><code>.</code></span></td>
</tr>
<tr>
<td><code>c:\foo/</code></td>
<td><span style="background-color: #CCFFCC"><code>c:\foo,.</code><br><code>c:,/,foo,.</code></span></td>
<td><code>c:\foo/</code></td>
<td><span style="background-color: #CCFFCC"><code>c:\foo/</code><br><code>c:/foo/</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:\</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>\</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:\foo/</code><br><code>foo/</code></span></td>
<td><code>c:\foo</code></td>
<td><code>.</code></td>
</tr>
<tr>
<td><code>c:/foo\bar</code></td>
<td><span style="background-color: #CCFFCC"><code>c:,foo\bar</code><br><code>c:,/,foo,bar</code></span></td>
<td><code>c:/foo\bar</code></td>
<td><span style="background-color: #CCFFCC"><code>c:/foo\bar</code><br><code>c:/foo/bar</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:/</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>c:</code></span></td>
<td><span style="background-color: #CCFFCC"><font size="-1"><i>empty</i></font><br><code>/</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:/foo\bar</code><br><code>foo\bar</code></span></td>
<td><span style="background-color: #CCFFCC"><code>c:</code><br><code>c:/foo</code></span></td>
<td><span style="background-color: #CCFFCC"><code>foo\bar</code><br><code>bar</code></span></td>
</tr>
</table>
<table border="1" cellspacing="0" cellpadding="5" width="1066">
</table>
<h2><a name="Acknowledgements">Acknowledgements</a></h2>
<p>This Filesystem Library is dedicated to my wife, Sonda, who provided the
support necessary to see both a trial implementation and the proposal itself
through to completion. She gave me the strength to continue after a difficult
year of cancer treatment in the middle of it all.</p>
<p>Many people contributed technical comments, ideas, and suggestions to the
Boost Filesystem Library. See
<a href="http://www.boost.org/libs/filesystem/doc/index.htm#Acknowledgements">
http://www.boost.org/libs/filesystem/doc/index.htm#Acknowledgements</a>.</p>
<p>Dietmar Kuehl contributed the original Boost Filesystem Library directory_iterator design. Peter Dimov, Walter Landry, Rob Stewart, and Thomas
Witt were particularly helpful in refining the library.</p>
<p>The create_directories, extension, basename, and replace_extension functions
were developed by Vladimir Prus.</p>
<p>Howard Hinnant and John Maddock reviewed a draft of the version 2 proposal, and
identified a number of mistakes or weaknesses, resulting in a more polished
final document.</p>
<p>Peter Dimov suggested a single class path, with member templates to adapt to
multiple string types. His idea became the basis for the version 3 path design.</p>
<h2><a name="References">References</a></h2>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td width="16%" valign="top">[<a name="ISO_POSIX">ISO-POSIX</a>]</td>
<td width="84%">ISO/IEC 9945:2003, IEEE&nbsp;Std&nbsp;1003.1-2001, and The Open Group
Base Specifications, Issue 6. Also known as The Single Unix<font face="Times New Roman">®
Specification, Version 3. Available from each of the organizations involved
in its creation. For example, read online or download from
<a href="http://www.unix.org/single_unix_specification/">
www.unix.org/single_unix_specification/</a>.</font> The ISO JTC1/SC22/WG15 -
POSIX homepage is <a href="http://www.open-std.org/jtc1/sc22/WG15/">
www.open-std.org/jtc1/sc22/WG15/</a></td>
</tr>
<tr>
<td width="16%" valign="top">[Abrahams]</td>
<td width="84%">Dave Abrahams, Error and Exception Handling,
<a href="http://www.boost.org/more/error_handling.html">
www.boost.org/more/error_handling.html</a></td>
</tr>
</table>
<hr>
<p>© Copyright Beman Dawes, 2002, 2006, 2007, 2009, 2010</p>
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->05 October 2010<!--webbot bot="Timestamp" endspan i-checksum="32123" --></p>
</body>
</html>