diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-10-30 12:57:26 -0700 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2012-10-30 12:57:26 -0700 |
commit | 1a78a62555be32868418fe52f8e330c9d0f95d5a (patch) | |
tree | d3765a80e7d3b9640ec2e930743630cd6b9fce2b /libs/filesystem/v3 | |
download | boost-1a78a62555be32868418fe52f8e330c9d0f95d5a.tar.gz boost-1a78a62555be32868418fe52f8e330c9d0f95d5a.tar.bz2 boost-1a78a62555be32868418fe52f8e330c9d0f95d5a.zip |
Imported Upstream version 1.49.0upstream/1.49.0
Diffstat (limited to 'libs/filesystem/v3')
113 files changed, 29046 insertions, 0 deletions
diff --git a/libs/filesystem/v3/build/Jamfile.v2 b/libs/filesystem/v3/build/Jamfile.v2 new file mode 100644 index 0000000000..c35cbbb057 --- /dev/null +++ b/libs/filesystem/v3/build/Jamfile.v2 @@ -0,0 +1,32 @@ +# Boost Filesystem Library Build Jamfile + +# (C) Copyright Beman Dawes 2002-2006 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or www.boost.org/LICENSE_1_0.txt) + + +# See library home page at http://www.boost.org/libs/filesystem + +project boost/filesystem + : source-location ../src + : usage-requirements # pass these requirement to dependents (i.e. users) + <link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1 + ; + +SOURCES = + operations path path_traits portability unique_path utf8_codecvt_facet windows_file_codecvt codecvt_error_category ; + +lib boost_filesystem + : $(SOURCES).cpp ../../system/build//boost_system + : <link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1 # tell source we're building dll's + : + : # Boost.Filesystem uses some of Boost.System functions in inlined/templated + # functions, so clients that use Boost.Filesystem will have direct references + # to Boost.System symbols. On Windows, Darwin, and some other platforms, this + # means those clients have to be directly linked to Boost.System. For static + # linking this happens anyway, but for shared we need to make it happen. Since + # doing so is harmless even when not needed, we do it for all platforms. + <link>shared:<library>../../system/build//boost_system + ; + +boost-install boost_filesystem ;
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/Jamfile.v2 b/libs/filesystem/v3/doc/Jamfile.v2 new file mode 100644 index 0000000000..4de58f538c --- /dev/null +++ b/libs/filesystem/v3/doc/Jamfile.v2 @@ -0,0 +1,19 @@ +# Boost Filesystem Library Example Jamfile + +# Copyright Beman Dawes 2010 + +# Distributed under the Boost Software License, Version 1.0. +# See www.boost.org/LICENSE_1_0.txt + +# Library home page: http://www.boost.org/libs/filesystem + +project + : requirements + <library>/boost/filesystem//boost_filesystem + <library>/boost/system//boost_system + <toolset>msvc:<asynch-exceptions>on + <link>static + ; + +exe path_table : path_table.cpp ; +install path_table-copy : path_table : <location>. ;
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/POSIX_filename_encoding.txt b/libs/filesystem/v3/doc/POSIX_filename_encoding.txt new file mode 100644 index 0000000000..14c45c07f2 --- /dev/null +++ b/libs/filesystem/v3/doc/POSIX_filename_encoding.txt @@ -0,0 +1,55 @@ +http://www.linuxfromscratch.org/blfs/view/svn/introduction/locale-issues.html + +"The POSIX standard mandates that the filename encoding is the encoding implied by the current LC_CTYPE locale category." + +------- + +http://mail.nl.linux.org/linux-utf8/2001-02/msg00103.html + +From: Markus Kuhn + +Tom Tromey wrote on 2001-02-05 00:36 UTC: +> Kai> IMAO, a *real* filesystem should use some encoding of ISO 10646 - +> Kai> UTF-8, UTF-16, or UTF-32 are all viable options. The same should +> Kai> be true for the kernel filename interfaces. +> +> I like this, but what should I do right now? + +The POSIX kernel file system interface is engraved into stone and +extremely unlikely to change. File names are arbitrary binary strings, +with only the '/' and '\0' bytes having any special semantics. You can +use arbitrary coded character sets on it as long as they do not +introduce '/' and '\0' bytes spuriously. Writers and readers have to +somehow agree on what encoding to use and the only really practical way +is to use the same encoding on all systems that share files. Eventually, +everyone will be using UTF-8 for file names on POSIX systems. Right now, +I would recommend users to use only ASCII for filenames, as this is +already UTF-8 and therefore simplifies migration. Using the ISO 8859, +JIS, etc. filenames should soon be considered deprecated practice. + +> I work on libgcj, the runtime component of gcj, the Java front end to +> GCC. In libgcj of course we use UCS-2 everywhere, since that is what +> Java does. Currently, for Unixy systems, we assume that all file +> names are UTF-8. + +The best solution is to assume that the file names are in the +locale-specific multi-byte encoding. Simply use mbrtowc and wcrtomb to +convert between Unicode and the locale-dependent multi-byte encoding +used in file names and text files if the ISO C 99 symbol +__STDC_ISO_10646__ is defined (which guarantees that wchar_t = UCS). On +Linux, this has been the case since glibc 2.2. + +> (Actually, we do something notably worse, which is +> assume that file names are Java-style UTF-8, with the weird encoding +> for \u0000.) + +\u0000 = NUL was never a character allowed in filenames under POSIX. +Raise an exception if someone tries to use it in a filename. Problem +solved. + +I never understood, why Java found it necessary to introduce two +distinct ASCII NUL characters. + +------ + +Interesting idea. Use iconv to create shift-jis or other mbcs test cases. diff --git a/libs/filesystem/v3/doc/deprecated.html b/libs/filesystem/v3/doc/deprecated.html new file mode 100644 index 0000000000..19df50cd15 --- /dev/null +++ b/libs/filesystem/v3/doc/deprecated.html @@ -0,0 +1,385 @@ +<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 Deprecated Features</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 Deprecated Features</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">Filesystem Home</a> + <a href="release_history.html">Releases</a> + <a href="reference.html">Reference</a> + <a href="tutorial.html">Tutorial</a> + <a href="faq.htm">FAQ</a> + <a href="portability_guide.htm">Portability</a> + <a href="v3.html">V3 Intro</a> + <a href="v3_design.html">V3 Design</a> + <a href="deprecated.html">Deprecated</a> + </td> +</table> + +<h2><a name="Deprecated-names">Deprecated names</a> and features</h2> +<p style="font-size: 10pt">As the library evolves over time, names sometimes +change or old features are removed to make way for new features. To ease transition, Boost.Filesystem deprecates +the old names and features, but by default continues to provide many of them. +The deprecated names and other workarounds can be suppressed by defining macro <code> +BOOST_FILESYSTEM_NO_DEPRECATED</code>, and this is recommended for all new code.</p> +<p style="font-size: 10pt">In the table, ✔ indicates a synonym or other +workaround is provided unless <code> +BOOST_FILESYSTEM_NO_DEPRECATED</code> is defined.</p> +<table border="1" cellpadding="5" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111"> + <tr> + <td style="font-size: 10pt" valign="top"> + <b><i>Component or location</i></b></td> + <td style="font-size: 10pt" valign="top"> + <p style="font-size: 10pt"><b><i>Old name, now deprecated</i></b></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <p style="font-size: 10pt"><b><i>New name</i></b></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"><code>class path</code></td> + <td style="font-size: 10pt" valign="top"><code>branch_path()</code></td> + <td style="font-size: 10pt" valign="top">✔</td> + <td style="font-size: 10pt" valign="top"><code>parent_path()</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class path</code></td> + <td style="font-size: 10pt" valign="top"> + <code>canonize()</code></td> + <td style="font-size: 10pt" valign="top"> + </td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class path</code></td> + <td style="font-size: 10pt" valign="top"> + <code>default_name_check()</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class path</code></td> + <td style="font-size: 10pt" valign="top"> + <code>default_name_check(name_check)</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class path</code></td> + <td style="font-size: 10pt" valign="top"> + <code>default_name_check_writable()</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"><code>class path</code></td> + <td style="font-size: 10pt" valign="top"><code>directory_string()</code></td> + <td style="font-size: 10pt" valign="top">✔</td> + <td style="font-size: 10pt" valign="top"><code>string</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"><code>class path</code></td> + <td style="font-size: 10pt" valign="top"><code>external_directory_string()</code></td> + <td style="font-size: 10pt" valign="top">✔</td> + <td style="font-size: 10pt" valign="top"><code>native()</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"><code>class path</code></td> + <td style="font-size: 10pt" valign="top"><code>external_file_string()</code></td> + <td style="font-size: 10pt" valign="top">✔</td> + <td style="font-size: 10pt" valign="top"><code>native()</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"><code>class path</code></td> + <td style="font-size: 10pt" valign="top"><code>file_string()</code></td> + <td style="font-size: 10pt" valign="top">✔</td> + <td style="font-size: 10pt" valign="top"><code>string()</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"><code>class path</code></td> + <td style="font-size: 10pt" valign="top"><code>has_branch_path()</code></td> + <td style="font-size: 10pt" valign="top">✔</td> + <td style="font-size: 10pt" valign="top"><code>has_parent_path()</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"><code>class path</code></td> + <td style="font-size: 10pt" valign="top"><code>has_leaf()</code></td> + <td style="font-size: 10pt" valign="top">✔</td> + <td style="font-size: 10pt" valign="top"><code>has_filename()</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"><code>class path</code></td> + <td style="font-size: 10pt" valign="top"><code>is_complere()</code></td> + <td style="font-size: 10pt" valign="top">✔</td> + <td style="font-size: 10pt" valign="top"><code>is_absolute()</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"><code>class path</code></td> + <td style="font-size: 10pt" valign="top"><code>leaf()</code></td> + <td style="font-size: 10pt" valign="top">✔</td> + <td style="font-size: 10pt" valign="top"><code>filename()</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class path</code></td> + <td style="font-size: 10pt" valign="top"> + <code>native_directory_string()</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <code>string()</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class path</code></td> + <td style="font-size: 10pt" valign="top"> + <code>native_file_string()</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <code>string()</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class path</code></td> + <td style="font-size: 10pt" valign="top"> + <code>normalize()</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class path</code></td> + <td style="font-size: 10pt" valign="top"> + <code>path(const string_type& str, name_check)</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed. Workaround ignores </i><code>name_check</code><i> + argument.</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class path</code></td> + <td style="font-size: 10pt" valign="top"> + <code>path(const string_type::value_type* s, name_check)</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed. Workaround ignores </i><code>name_check</code><i> + argument.</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class path</code></td> + <td style="font-size: 10pt" valign="top"> + <p style="font-size: 10pt"><code>remove_leaf()</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <p style="font-size: 10pt"><code>remove_filename()</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>path.hpp</code></td> + <td style="font-size: 10pt" valign="top"> + <code>template<class String, class Traits><br> + class basic_path;</code></td> + <td style="font-size: 10pt" valign="top"> + </td> + <td style="font-size: 10pt" valign="top"> + Class template <code>basic_path</code> is replaced by <code>class path</code>. + No workaround for an explicitly coded <code>basic_path</code> is provided, + but see the next row - <code>path</code>.</td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>path.hpp</code></td> + <td style="font-size: 10pt" valign="top"> + <code>typedef basic_path<std::string, path_traits> path</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <code>class path</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>path.hpp</code></td> + <td style="font-size: 10pt" valign="top"> + <code>typedef basic_path<std::wstring, wpath_traits> wpath</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <i>Removed; use </i><code>class path</code><i> instead. Workaround provides + </i><code>typedef path wpath</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>operations.hpp</code></td> + <td style="font-size: 10pt" valign="top"> + <code>initial_path()</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>operations.hpp</code></td> + <td style="font-size: 10pt" valign="top"> + <p dir="ltr"><code>template <class Path><br> + Path complete(const Path& p,<br> + const Path& base=<br> + initial_path<Path>())</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <p dir="ltr"><code>path absolute(const path& p, const path& base=<br> + current_path())</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>operations.hpp</code></td> + <td style="font-size: 10pt" valign="top"> + <code>is_regular(file_status f)</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <p dir="ltr"> + <code>is_regular_file(file_status f)</code></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>operations.hpp</code></td> + <td style="font-size: 10pt" valign="top"> + <code>symbolic_link_exists(const path& ph)</code></td> + <td style="font-size: 10pt" valign="top"> + </td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class directory_entry</code></td> + <td style="font-size: 10pt" valign="top"> + <code>filename()</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed, use </i><code>path().filename()</code><i> instead.</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class directory_entry</code></td> + <td style="font-size: 10pt" valign="top"> + <code>leaf()</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed, use </i><code>path().filename()</code><i> instead.</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + <code>class directory_entry</code></td> + <td style="font-size: 10pt" valign="top"> + <code>string()</code></td> + <td style="font-size: 10pt" valign="top"> + ✔</td> + <td style="font-size: 10pt" valign="top"> + <i>Function removed, use </i><code>path().string()</code><i> instead.</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + Macro definitions</td> + <td style="font-size: 10pt" valign="top"> + <code>BOOST_WINDOW_API</code></td> + <td style="font-size: 10pt" valign="top"> + </td> + <td style="font-size: 10pt" valign="top"> + <i>No longer supported; API selection is always automatic.</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + Macro definitions</td> + <td style="font-size: 10pt" valign="top"> + <code>BOOST_POSIX_API</code></td> + <td style="font-size: 10pt" valign="top"> + </td> + <td style="font-size: 10pt" valign="top"> + <i>No longer supported; API selection is always automatic.</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + Macro definitions</td> + <td style="font-size: 10pt" valign="top"> + <code>BOOST_WINDOW_PATH</code></td> + <td style="font-size: 10pt" valign="top"> + </td> + <td style="font-size: 10pt" valign="top"> + <i>No longer supported; native path format selection is always automatic.</i></td> + </tr> + <tr> + <td style="font-size: 10pt" valign="top"> + Macro definitions</td> + <td style="font-size: 10pt" valign="top"> + <code>BOOST_POSIX_PATH</code></td> + <td style="font-size: 10pt" valign="top"> + </td> + <td style="font-size: 10pt" valign="top"> + <i>No longer supported; native path format selection is always automatic.</i></td> + </tr> +</table> + +<h2>Deprecation rationale</h2> +<h3><code>initial_path</code> function</h3> +<p dir="ltr">Full implementation of <code>initial_path()</code> would require +support from the C++ runtime startup code, and that doesn't seem likely to +happen. Depending on the user to call <code>initial_path()</code> at the +beginning of <code>main()</code> is too error prone. An equivalent +function can trivially be provided by a user.</p> + +<hr> +<p>Revised +<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->20 February, 2011<!--webbot bot="Timestamp" endspan i-checksum="40524" --></p> + +<p>© Copyright Beman Dawes, 2002-2005, 2010</p> +<p> Use, modification, and distribution are subject to 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> + +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/design.htm b/libs/filesystem/v3/doc/design.htm new file mode 100644 index 0000000000..17ac7d68b2 --- /dev/null +++ b/libs/filesystem/v3/doc/design.htm @@ -0,0 +1,353 @@ +<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>Boost Filesystem Library Design</title> +<link rel="stylesheet" type="text/css" href="../../../../doc/src/minimal.css"> +</head> + +<body bgcolor="#FFFFFF"> + +<h1> +<img border="0" src="../../../../boost.png" align="center" width="277" height="86">Filesystem +Library Design</h1> + +<p><a href="#Introduction">Introduction</a><br> +<a href="#Requirements">Requirements</a><br> +<a href="#Realities">Realities</a><br> +<a href="#Rationale">Rationale</a><br> +<a href="#Abandoned_Designs">Abandoned_Designs</a><br> +<a href="#References">References</a></p> + +<h2><a name="Introduction">Introduction</a></h2> + +<p>The primary motivation for beginning work on the Filesystem Library was +frustration with Boost administrative tools. Scripts were written in +Python, Perl, Bash, and Windows command languages. There was no single +scripting language familiar and acceptable to all Boost administrators. Yet they +were all skilled C++ programmers - why couldn't C++ be used as the scripting +language?</p> + +<p>The key feature C++ lacked for script-like applications was the ability to +perform portable filesystem operations on directories and their contents. The +Filesystem Library was developed to fill that void.</p> + +<p>The intent is not to compete with traditional scripting languages, but to +provide a solution for situations where C++ is already the language +of choice..</p> + +<h2><a name="Requirements">Requirements</a></h2> +<ul> + <li>Be able to write portable script-style filesystem operations in modern + C++.<br> + <br> + Rationale: This is a common programming need. It is both an + embarrassment and a hardship that this is not possible with either the current + C++ or Boost libraries. The need is particularly acute + when C++ is the only toolset allowed in the tool chain. File system + operations are provided by many languages used on multiple platforms, + such as Perl and Python, as well as by many platform specific scripting + languages. All operating systems provide some form of API for filesystem + operations, and the POSIX bindings are increasingly available even on + operating systems not normally associated with POSIX, such as the Mac, z/OS, + or OS/390.<br> + </li> + <li>Work within the <a href="#Realities">realities</a> described below.<br> + <br> + Rationale: This isn't a research project. The need is for something that works on + today's platforms, including some of the embedded operating systems + with limited file systems. Because of the emphasis on portability, such a + library would be much more useful if standardized. That means being able to + work with a much wider range of platforms that just Unix or Windows and their + clones.<br> + </li> + <li>Avoid dangerous programming practices. Particularly, all-too-easy-to-ignore error notifications + and use of global variables. If a dangerous feature is provided, identify it as such.<br> + <br> + Rationale: Normally this would be covered by "the usual Boost requirements...", + but it is mentioned explicitly because the equivalent native platform and + scripting language interfaces often depend on all-too-easy-to-ignore error + notifications and global variables like "current + working directory".<br> + </li> + <li>Structure the library so that it is still useful even if some functionality + does not map well onto a given platform or directory tree. Particularly, much + useful functionality should be portable even to flat +(non-hierarchical) filesystems.<br> + <br> + Rationale: Much functionality which does not + require a hierarchical directory structure is still useful on flat-structure + filesystems. There are many systems, particularly embedded systems, + where even very limited functionality is still useful.</li> +</ul> +<ul> + <li>Interface smoothly with current C++ Standard Library input/output + facilities. For example, paths should be + easy to use in std::basic_fstream constructors.<br> + <br> + Rationale: One of the most common uses of file system functionality is to + manipulate paths for eventual use in input/output operations. + Thus the need to interface smoothly with standard library I/O.<br> + </li> + <li>Suitable for eventual standardization. The implication of this requirement + is that the interface be close to minimal, and that great care be take + regarding portability.<br> + <br> + Rationale: The lack of file system operations is a serious hole + in the current standard, with no other known candidates to fill that hole. + Libraries with elaborate interfaces and difficult to port specifications are much less likely to be accepted for + standardization.<br> + </li> + <li>The usual Boost <a href="http://www.boost.org/more/lib_guide.htm">requirements and + guidelines</a> apply.<br> + </li> + <li>Encourage, but do not require, portability in path names.<br> + <br> + Rationale: For paths which originate from user input it is unreasonable to + require portable path syntax.<br> + </li> + <li>Avoid giving the illusion of portability where portability in fact does not + exist.<br> + <br> + Rationale: Leaving important behavior unspecified or "implementation defined" does a + great disservice to programmers using a library because it makes it appear + that code relying on the behavior is portable, when in fact there is nothing + portable about it. The only case where such under-specification is acceptable is when both users and implementors know from + other sources exactly what behavior is required, yet for some reason it isn't + possible to specify it exactly.</li> +</ul> +<h2><a name="Realities">Realities</a></h2> +<ul> + <li>Some operating systems have a single directory tree root, others have + multiple roots.<br> + </li> + <li>Some file systems provide both a long and short form of filenames.<br> + </li> + <li>Some file systems have different syntax for file paths and directory + paths.<br> + </li> + <li>Some file systems have different rules for valid file names and valid + directory names.<br> + </li> + <li>Some file systems (ISO-9660, level 1, for example) use very restricted + (so-called 8.3) file names.<br> + </li> + <li>Some operating systems allow file systems with different + characteristics to be "mounted" within a directory tree. Thus a + ISO-9660 or Windows + file system may end up as a sub-tree of a POSIX directory tree.<br> + </li> + <li>Wide-character versions of directory and file operations are available on some operating + systems, and not available on others.<br> + </li> + <li>There is no law that says directory hierarchies have to be specified in + terms of left-to-right decent from the root.<br> + </li> + <li>Some file systems have a concept of file "version number" or "generation + number". Some don't.<br> + </li> + <li>Not all operating systems use single character separators in path names. Some use + paired notations. A typical fully-specified OpenVMS filename + might look something like this:<br> + <br> + <code> DISK$SCRATCH:[GEORGE.PROJECT1.DAT]BIG_DATA_FILE.NTP;5<br> + </code><br> + The general OpenVMS format is:<br> + <br> + + <i>Device:[directories.dot.separated]filename.extension;version_number</i><br> + </li> + <li>For common file systems, determining if two descriptors are for same + entity is extremely difficult or impossible. For example, the concept of + equality can be different for each portion of a path - some portions may be + case or locale sensitive, others not. Case sensitivity is a property of the + pathname itself, and not the platform. Determining collating sequence is even + worse.<br> + </li> + <li>Race-conditions may occur. Directory trees, directories, files, and file attributes are in effect shared between all threads, processes, and computers which have access to the + filesystem. That may well include computers on the other side of the + world or in orbit around the world. This implies that file system operations + may fail in unexpected ways. For example:<br> + <br> + <code> assert( exists("foo") == exists("foo") ); + // may fail!<br> + assert( is_directory("foo") == is_directory("foo"); + // may fail!<br> + </code><br> + In the first example, the file may have been deleted between calls to + exists(). In the second example, the file may have been deleted and then + replaced by a directory of the same name between the calls to is_directory().<br> + </li> + <li>Even though an application may be portable, it still will have to traffic + in system specific paths occasionally; user provided input is a common + example.<br> + </li> + <li><a name="symbolic-link-use-case">Symbolic</a> links cause canonical and + normal form of some paths to represent different files or directories. For + example, given the directory hierarchy <code>/a/b/c</code>, with a symbolic + link in <code>/a</code> named <code>x</code> pointing to <code>b/c</code>, + then under POSIX Pathname Resolution rules a path of <code>"/a/x/.."</code> + should resolve to <code>"/a/b"</code>. If <code>"/a/x/.."</code> were first + normalized to <code>"/a"</code>, it would resolve incorrectly. (Case supplied + by Walter Landry.)</li> +</ul> + +<h2><a name="Rationale">Rationale</a></h2> + +<p>The <a href="#Requirements">Requirements</a> and <a href="#Realities"> +Realities</a> above drove much of the C++ interface design. In particular, +the desire to make script-like code straightforward caused a great deal of +effort to go into ensuring that apparently simple expressions like <i>exists( "foo" +)</i> work as expected.</p> + +<p>See the <a href="faq.htm">FAQ</a> for the rationale behind many detailed +design decisions.</p> + +<p>Several key insights went into the <i>path</i> class design:</p> +<ul> + <li>Decoupling of the input formats, internal conceptual (<i>vector<string></i> + or other sequence) + model, and output formats.</li> + <li>Providing two input formats (generic and O/S specific) broke a major + design deadlock.</li> + <li>Providing several output formats solved another set of previously + intractable problems.</li> + <li>Several non-obvious functions (particularly decomposition and composition) + are required to support portable code. (Peter Dimov, Thomas Witt, Glen + Knowles, others.)</li> +</ul> + +<p>Error checking was a particularly difficult area. One key insight was that +with file and directory names, portability isn't a universal truth. +Rather, the programmer must think out the question "What operating systems do I +want this path to be portable to?" By providing support for several +answers to that question, the Filesystem Library alerts programmers of the need +to ask it in the first place.</p> +<h2><a name="Abandoned_Designs">Abandoned Designs</a></h2> +<h3>operations.hpp</h3> +<p>Dietmar Kühl's original dir_it design and implementation supported +wide-character file and directory names. It was abandoned after extensive +discussions among Library Working Group members failed to identify portable +semantics for wide-character names on systems not providing native support. See +<a href="faq.htm#wide-character_names">FAQ</a>.</p> +<p>Previous iterations of the interface design used explicitly named functions providing a +large number of convenience operations, with no compile-time or run-time +options. There were so many function names that they were very confusing to use, +and the interface was much larger. Any benefits seemed theoretical rather than +real. </p> +<p>Designs based on compile time (rather than runtime) flag and option selection +(via policy, enum, or int template parameters) became so complicated that they +were abandoned, often after investing quite a bit of time and effort. The need +to qualify attribute or option names with namespaces, even aliases, made use in +template parameters ugly; that wasn't fully appreciated until actually writing +real code.</p> +<p>Yet another set of convenience functions ( for example, <i>remove</i> with +permissive, prune, recurse, and other options, plus predicate, and possibly +other, filtering features) were abandoned because the details became both +complex and contentious.</p> + +<p>What is left is a toolkit of low-level operations from which the user can +create more complex convenience operations, plus a very small number of +convenience functions which were found to be useful enough to justify inclusion.</p> + +<h3>path.hpp</h3> + +<p>There were so many abandoned path designs, I've lost track. Policy-based +class templates in several flavors, constructor supplied runtime policies, +operation specific runtime policies, they were all considered, often +implemented, and ultimately abandoned as far too complicated for any small +benefits observed.</p> + +<p>Additional design considerations apply to <a href="v3_design.html">Internationalization</a>. </p> + +<h3>error checking</h3> + +<p>A number of designs for the error checking machinery were abandoned, some +after experiments with implementations. Totally automatic error checking was +attempted in particular. But automatic error checking tended to make the overall +library design much more complicated.</p> + +<p>Some designs associated error checking mechanisms with paths. Some with +operations functions. A policy-based error checking template design was +partially implemented, then abandoned as too complicated for everyday +script-like programs.</p> + +<p>The final design, which depends partially on explicit error checking function +calls, is much simpler and straightforward, although it does depend to +some extent on programmer discipline. But it should allow programmers who +are concerned about portability to be reasonably sure that their programs will +work correctly on their choice of target systems.</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="13%" valign="top">[<a name="IBM-01">IBM-01</a>]</td> + <td width="87%">IBM Corporation, <i>z/OS V1R3.0 C/C++ Run-Time +Library Reference</i>, SA22-7821-02, 2001, +<a href="http://www-1.ibm.com/servers/eserver/zseries/zos/bkserv/"> + www-1.ibm.com/servers/eserver/zseries/zos/bkserv/</a></td> + </tr> + <tr> + <td width="13%" valign="top">[<a name="ISO-9660">ISO-9660</a>]</td> + <td width="87%">International Standards Organization, 1988</td> + </tr> + <tr> + <td width="13%" valign="top">[<a name="Kuhn">Kuhn</a>]</td> + <td width="87%">UTF-8 and Unicode FAQ for Unix/Linux, +<a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html"> + www.cl.cam.ac.uk/~mgk25/unicode.html</a></td> + </tr> + <tr> + <td width="13%" valign="top">[<a name="MSDN">MSDN</a>] </td> + <td width="87%">Microsoft Platform SDK for Windows, Storage Start +Page, +<a href="http://msdn.microsoft.com/library/en-us/fileio/base/storage_start_page.asp"> + msdn.microsoft.com/library/en-us/fileio/base/storage_start_page.asp</a></td> + </tr> + <tr> + <td width="13%" valign="top">[<a name="POSIX-01">POSIX-01</a>]</td> + <td width="87%">IEEE Std 1003.1-2001, ISO/IEC 9945:2002, 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="13%" valign="top">[<a name="URI">URI</a>]</td> + <td width="87%">RFC-2396, Uniform Resource Identifiers (URI): Generic +Syntax, <a href="http://www.ietf.org/rfc/rfc2396.txt"> + www.ietf.org/rfc/rfc2396.txt</a></td> + </tr> + <tr> + <td width="13%" valign="top">[<a name="UTF-16">UTF-16</a>]</td> + <td width="87%">Wikipedia, UTF-16, +<a href="http://en.wikipedia.org/wiki/UTF-16"> + en.wikipedia.org/wiki/UTF-16</a></td> + </tr> + <tr> + <td width="13%" valign="top">[<a name="Wulf-Shaw-73">Wulf-Shaw-73</a>]</td> + <td width="87%">William Wulf, Mary Shaw, <i>Global +Variable Considered Harmful</i>, ACM SIGPLAN Notices, 8, 2, 1973, pp. 23-34</td> + </tr> +</table> + +<hr> +<p>Revised +<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->18 February, 2010<!--webbot bot="Timestamp" endspan i-checksum="40538" --></p> + +<p>© Copyright Beman Dawes, 2002</p> +<p> Use, modification, and distribution are subject to the Boost Software +License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt"> +LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> +www.boost.org/LICENSE_1_0.txt</a>)</p> + +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/do_list.html b/libs/filesystem/v3/doc/do_list.html new file mode 100644 index 0000000000..6558803279 --- /dev/null +++ b/libs/filesystem/v3/doc/do_list.html @@ -0,0 +1,146 @@ +<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>Do List</title> +<style type="text/css"> + body { font-family: sans-serif; margin: 1em; } + p, td, li, blockquote { font-size: 10pt; } + pre { font-size: 9pt; } +</style> +</head> + +<body> + +<h1>Boost Filesystem Do List<br> +<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->24 June 2010<!--webbot bot="Timestamp" endspan i-checksum="17552" --></h1> + +<h2>Beta 1 comments</h2> +<ul> + <li dir="ltr"> + +<p dir="ltr">Zach Laine:</li> +</ul> +<blockquote> + <pre dir="ltr">The descriptions for portable_name() and portable_directory_name() +appear to be at odds. + +portable_name() : ... && (name is "." or "..", and the first character +not a period or hyphen) + +portable_directory_name(): ... && (name is "." or ".." or contains no periods) + +Should portable_name() be "... && (name is "." or "..", or contains no +periods) && (first character not a hyphen)"? Maybe I'm missing +something?</pre> +</blockquote> +<ul> + <li dir="ltr"> +<p dir="ltr">Scott McMurray - treat as Wish List:</li> +</ul> +<blockquote> + <pre dir="ltr">- uncomplete(p, base) + +My pet request. It may be useful to simplify other functions as well, +since there's no current way to go from an absolute path to a relative +one, meaning that most functions need to handle relative ones even +when that might not be natural. With this functionality, +preconditions requiring absolute paths would be less onerous. + + Precondition: p.is_absolute() && base.is_absolute() + + Effects: Extracts a path, rp, from p relative to base such that +canonical(p) == complete(rp, base). Any ".." path elements in rp form +a prefix. + + Returns: The extracted path. + + Postconditions: For the returned path, rp, rp.is_relative() == +(p.root_name() == b.root_name()). + +[Notes: This function simplifies paths by omitting context. It is +particularly useful for serializing paths such that it can be usefully +moved between hosts where the context may be different, such as inside +source control trees. It can also be helpful for display to users, +such as in shells where paths are often shown relative to $HOME. + +In the presence of symlinks, the result of this function may differ +between implementations, as some may expand symlinks that others may +not. The simplest implementation uses canonical to expand both p and +base, then removes the common prefix and prepends the requisite ".." +elements. Smarter implementations will avoid expanding symlinks +unnecessarily. No implementation is expected to discover new symlinks +to return paths with fewer elements.]</pre> +</blockquote> +<h2 dir="ltr">Docs</h2> +<ul> + <li>Reorganize files - delete examples that no longer apply.</li> + <li>Should minimal.css be changed to used relative font sizes? See + <a href="http://www.w3schools.com/CSS/pr_font_font-size.asp/">http://www.w3schools.com/CSS/pr_font_font-size.asp\</a></li> + <li>Document behavior of path::replace_extension has change WRT argument w/o a + dot.</li> + <li style="font-size: 10pt">Document leading //: no longer treated specially. + But is that really correct?</li> + <li style="font-size: 10pt">Behavior of root_path() has been changed. Change + needs to be propagated to trunk?</li> + <li style="font-size: 10pt">Regenerate path decomposition table.</li> +</ul> + +<h2>Code</h2> +<h3>All</h3> +<ul> + <li style="font-size: 10pt">Move semantics.</li> + <li style="font-size: 10pt">Use BOOST_DELETED, BOOST_DEFAULTED, where + appropriate.</li> + <li style="font-size: 10pt">Other C++0x features.</li> +</ul> +<h3>Class path</h3> +<ul> + <li>Windows, POSIX, conversions for char16_t, char32_t for C++0x compilers.</li> + <li>Add Windows Alternate Data Stream test cases. See http://en.wikipedia.org/wiki/NTFS + Features.</li> + <li>Add test case: relational operators on paths differing only in trailing + separator. Rationale?</li> + <li>Provide the name check functions for more character types? Templatize? + take a path argument?</li> + <li style="font-size: 10pt">Add codepage 936/950/etc test cases.</li> + <li style="font-size: 10pt">Should UDT's be supported?</li> + <li style="font-size: 10pt">Should path iteration to a separator result in:<br> + -- the actual separator used<br> + -- the preferred separator<br> + -- the generic separator <-- makes it easier to write portable code<br> + -- a dot</li> +</ul> +<h3>Operations</h3> +<ul> + <li>Would complete(), system_complete() be clearer if renamed absolute(), + absolute_system() (or absolute_native())?</li> + <li>Review all operations.cpp code for race conditions similar to #2925. Fix + or document.</li> + <li>Enable all BOOST_FILESYSTEM_NO_DEPRECATED code.</li> + <li>rename and remove names are problems. If users says "using + namespace boost::filesystem"<br> + and some header included stdio, there is just too much chance of silent error.</li> + <li>create_directories error handling needs work.</li> + <li>Fold convenience.hpp into operations.hpp</li> + <li>Two argument recursive_directory_iterator ctor isn't recognizing throws(). + Would it be better to fold into a single two argument ctor with default?</li> + <li>Add the push_directory class from tools/release/required_files.cpp</li> +</ul> + +<h3>Miscellaneous</h3> +<ul> + <li style="font-size: 10pt"><i>Regular</i> classes need hash functions.</li> +</ul> + +<hr> +<p>© Copyright Beman Dawes, 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> + +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/faq.htm b/libs/filesystem/v3/doc/faq.htm new file mode 100644 index 0000000000..781098c55f --- /dev/null +++ b/libs/filesystem/v3/doc/faq.htm @@ -0,0 +1,147 @@ +<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 FAQ</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 FAQ</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">Filesystem Home</a> + <a href="release_history.html">Releases</a> + <a href="reference.html">Reference</a> + <a href="tutorial.html">Tutorial</a> + <a href="faq.htm">FAQ</a> + <a href="portability_guide.htm">Portability</a> + <a href="v3.html">V3 Intro</a> + <a href="v3_design.html">V3 Design</a> + <a href="deprecated.html">Deprecated</a> + </td> + </tr> +</table> + +<h1 dir="ltr"> +Frequently Asked Questions</h1> +<h2>General questions</h2> +<p><b>Why not support a concept of specific kinds of file systems, such as posix_file_system or windows_file_system.</b></p> +<p>Portability is one of the most important requirements for the +library. Features specific to a particular operating system or file system +can always be accessed by using the operating system's API.</p> + +<h2 dir="ltr"> +Class <code><font size="6">path</font></code> questions </h2> +<p><b>Why base the generic pathname format on POSIX?</b></p> +<p><a href="design.htm#POSIX-01">POSIX</a> is an ISO Standard. It is the basis for the most familiar +pathname formats, +not just for POSIX-based operating systems but also for Windows and the +URL portion of URI's. It is ubiquitous and +familiar. On many systems, it is very easy to implement because it is +either the native operating system format (Unix and Windows) or via a +operating system supplied +POSIX library (z/OS, OS/390, and many more.)</p> +<p><b>Why not use a full URI (Universal Resource Identifier) based path?</b></p> +<p><a href="design.htm#URI">URI's</a> would promise more than the Filesystem Library can actually deliver, +since URI's extend far beyond what most operating systems consider a file or a +directory. Thus for the primary "portable script-style file system +operations" requirement of the Filesystem Library, full URI's appear to be over-specification.</p> +<p><b>Why isn't <i>path</i> a base class with derived <i>directory_path</i> and +<i>file_path</i> classes?</b></p> +<p>Why bother? The behavior of all three classes is essentially identical. +Several early versions did require users to identify each path as a file or +directory path, and this seemed to increase coding errors and decrease code +readability. There was no apparent upside benefit.</p> +<p><b>Why do path decomposition functions yielding a single element return a +path rather than a string?</b></p> +<p>Interface simplicity. If they returned strings, flavors would be needed for +<code>string</code>, <code>wstring</code>, <code>u16string</code>, <code> +u32string</code>, and generic strings.</p> +<p><b>Why don't path member functions have overloads with error_code& arguments?</b></p> +<p>They have not been requested by users; the need for error reporting via +error_code seems limited to operations failures rather than path failures.</p> +<h2>Operations function questions</h2> +<p><b>Why not supply a 'handle' type, and let the file and directory operations +traffic in it?</b></p> +<p>It isn't clear there is any feasible way to meet the "portable script-style +file system operations" requirement with such a system. File systems exist where operations are usually performed on + some non-string handle type. The classic Mac OS has been mentioned explicitly as a case where +trafficking in paths isn't always natural. </p> +<p>The case for the "handle" (opaque data type to identify a file) +style may be strongest for directory iterator value type. (See Jesse Jones' Jan 28, +2002, Boost postings). However, as class path has evolved, it seems sufficient +even as the directory iterator value type.</p> +<p><b>Why are the operations functions so low-level?</b></p> +<p>To provide a toolkit from which higher-level functionality can be created.</p> +<p>An +extended attempt to add convenience functions on top of, or as a replacement +for, the low-level functionality failed because there is no widely acceptable +set of simple semantics for most convenience functions considered. +Attempts to provide alternate semantics via either run-time options or +compile-time polices became overly complicated in relation to the value +delivered, or became contentious. OTOH, the specific functionality needed for several trial +applications was very easy for the user to construct from the lower-level +toolkit functions. See <a href="design.htm#Abandoned_Designs">Failed +Attempts</a>.</p> +<p><b>Isn't it inconsistent then to provide a few convenience functions?</b></p> +<p>Yes, but experience with both this library, POSIX, and Windows, indicates +the utility of certain convenience functions, and that it is possible to provide +simple, yet widely acceptable, semantics for them. For example, <code>remove_all()</code>.</p> +<p><b>Why are there directory_iterator overloads for operations.hpp +predicate functions? Isn't two ways to do the same thing poor design?</b></p> +<p>Yes, two ways to do the same thing is often a poor design practice. But the +iterator versions are often much more efficient. Calling status() during +iteration over a directory containing 15,000 files took 6 seconds for the path +overload, and 1 second for the iterator overload, for tests on a freshly booted +machine. Times were .90 seconds and .30 seconds, for tests after prior use of +the directory. This performance gain is large enough to justify deviating from +preferred design practices. Neither overload alone meets all needs.</p> +<p><b>Why are the operations functions so picky about errors?</b></p> +<p>Safety. The default is to be safe rather than sorry. This is particularly +important given the reality that on many computer systems files and directories +are globally shared resources, and thus subject to +race conditions.</p> +<p><b>Why are attributes accessed via named functions rather than property maps?</b></p> +<p>For commonly used attributes (existence, directory or file, emptiness), +simple syntax and guaranteed presence outweigh other considerations. Because +access to many other attributes is inherently system dependent, +property maps are viewed as the best hope for access and modification, but it is +better design to provide such functionality in a separate library. (Historical +note: even the apparently simple attribute "read-only" turned out to be so +system depend as to be disqualified as a "guaranteed presence" operation.)</p> +<p><b>Why isn't automatic name portability error detection provided?</b></p> +<p>A number (at least six) of designs for name validity error +detection were evaluated, including at least four complete implementations. +While the details for rejection differed, all of the more powerful name validity checking +designs distorted other +otherwise simple aspects of the library. Even the simple name checking provided +in prior library versions was a constant source of user complaints. While name checking can be helpful, it +isn't important enough to justify added a lot of additional complexity.</p> +<p><b>Why are paths sometimes manipulated by member functions and sometimes by +non-member functions?</b></p> +<p>The design rule is that purely lexical operations are supplied as <i>class +path</i> member +functions, while operations performed by the operating system are provided as +free functions.</p> +<hr> +<p>Revised +<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->20 February, 2011<!--webbot bot="Timestamp" endspan i-checksum="40524" --></p> +<p>© Copyright Beman Dawes, 2002</p> +<p> Use, modification, and distribution are subject to 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>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/index.htm b/libs/filesystem/v3/doc/index.htm new file mode 100644 index 0000000000..44e2eb486a --- /dev/null +++ b/libs/filesystem/v3/doc/index.htm @@ -0,0 +1,495 @@ +<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 Home</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> + 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">Filesystem Home</a> + <a href="release_history.html">Releases</a> + <a href="reference.html">Reference</a> + <a href="tutorial.html">Tutorial</a> + <a href="faq.htm">FAQ</a> + <a href="portability_guide.htm">Portability</a> + <a href="v3.html">V3 Intro</a> + <a href="v3_design.html">V3 Design</a> + <a href="deprecated.html">Deprecated</a> + </td> + </tr> +</table> + +<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" align="right"> + <tr> + <td width="100%" bgcolor="#D7EEFF" align="center"> + <i><b>Contents</b></i></td> + </tr> + <tr> + <td width="100%" bgcolor="#E8F5FF"> + <a href="#Introduction">Introduction</a><br> + <a href="#Documentation">Documentation</a><br> + <a href="#Using">Using the library</a><br> + <a href="#Coding-guidelines">Coding guidelines</a><br> + <a href="#Cautions">Cautions</a><br> + <a href="#Headers">Headers</a><br> + <a href="#Examples">Example programs</a><br> + <a href="#Implementation">Implementation</a><br> + <a href="#Macros">Macros</a><br> + <a href="#Building">Building the object-library</a><br> + <a href="#Cgywin">Notes for Cygwin users</a><br> + <a href="#Change-history">Version history<br> + with acknowledgements</a></td> + </tr> + </table> + +<div align="center"> + <center> + <table border="1" cellpadding="10" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111"> + <tr> + <td> + <p align="center"><b>This is the home page for Version 3 of the Filesystem library.</b></p> + <p align="left">Version 3 is a major revision with many new and improved + features. It may, however, break some user code written for Version 2.</p> + <p align="left">To ease the transition, Boost releases 1.44 through 1.47 + will supply both V2 and V3. <a href="../../v2/doc/index.htm">Version 2</a> + is the default version for Boost release 1.44 + and 1.45. Version 3 will be the default starting with release 1.46.</p> + <p align="left"><b>Define macro BOOST_FILESYSTEM_VERSION as 3 to use + Version 3. This will be the default for release 1.46 and later.</b></p> + <p align="left"><b>Define macro BOOST_FILESYSTEM_VERSION as 2 to use + Version 2. This is the default for release 1.44 and 1.45.</b></p> + <p align="left"><b>You may define the BOOST_FILESYSTEM_VERSION macro:</b></p> + <ul> + <li> + <p align="left"><b>On the build command line; the exact format depends on + your compiler or IDE</b></p> + </li> + <li> + <p align="left"><b>In your code, before including any filesystem header, + #define BOOST_FILESYSTEM_VERSION <i>n</i></b></p> + </li> + <li> + <p align="left"><b>#define BOOST_FILESYSTEM_VERSION <i>n </i>in boost/config/user.hpp. + Note that this approach applies to all uses of Boost.Filesystem.</b></p> + </li> + </ul> + <p align="left">Existing code should be moved to Version 3 as soon as + convenient. New code should be written for Version 3.</p> + <p align="left">Version 2 is deprecated, and will not be included in Boost + releases 1.48 and later.</p> + <p align="left"><b>Building the library</b></p> + <p align="left">By default, the Boost build system creates libraries that + support both version 2 and version 3. To support only a single version, + include <code>--disable-filesystem2</code> or <code>--disable-filesystem3</code> + on the <code>bjam</code> command line.</p> + </td> + </tr> + </table> + </center> +</div> + +<h2><a name="Introduction">Introduction</a></h2> +<p>The Boost.Filesystem library provides facilities to manipulate files and directories, +and the paths that identify them.</p> + +<p>The features of the library include:</p> + +<ul> + <li><b>A modern C++ interface, highly compatible with the C++ standard + library.</b></li> +</ul> +<blockquote> + <blockquote> + +<p>Many users say the interface is their primary motivation for using +Boost.Filesystem. They like its use of familiar idioms based on standard library +containers, iterators, and algorithms. They like having errors reported by +throwing exceptions.</p> + + </blockquote> +</blockquote> +<ul> + <li><b>Portability between operating systems.</b><br> + <ul> + <li>At the C++ syntax level, it is convenient to learn and use one interface + regardless of the operating system.</li> + <li>At the semantic level, behavior of code is reasonably portable across + operating systems.</li> + <li>Dual generic or native path format support encourages program + portability, yet still allows communication with users in system specific + formats.<br> + </li> + </ul> + </li> + <li><b>Error handling and reporting via C++ exceptions (the default) or error + codes.</b><br> + <ul> + <li>C++ exceptions are the preferred error reporting mechanism for most + applications. The exception thrown includes the detailed error code + information important for diagnosing the exact cause of file system errors.</li> + <li>Error reporting via error code allows user code that provides detailed + error recovery to avoid becoming so littered with try-catch blocks as to be + unmaintainable. <br> + </li> + </ul> + </li> + <li><b>Suitable for a broad spectrum of applications, ranging from simple + script-like operations to extremely complex production code.</b><br> + <ul> + <li>At the simple script-like end of the spectrum, the intent is not to + compete with Python, Perl, or shell languages, but rather to provide + filesystem operations when C++ is already the language of choice.</li> + <li>Finer grained control over operations and error handling is available to + support more complex applications or other cases where throwing exceptions + isn't desired.</li> + </ul> + </li> +</ul> + +<p>A proposal, +<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1975.html"> +N1975</a>, to include Boost.Filesystem in Technical Report 2 has been accepted +by the C++ Standards Committee. That proposal was based on version 2 of +Boost.Filesystem; presumably the final TR2 form will be based on version 3.</p> + +<h2><a name="Documentation">Documentation</a></h2> + +<p><b><a href="tutorial.html">Tutorial</a></b> - A gentle introduction to +the library, with example programs provided for you to experiment with.</p> + +<p><b><a href="reference.html">Reference</a></b> - Formal documentation in the +style of the C++ standard for +every component of the library.</p> + +<p><b><a href="faq.htm">FAQ</a></b> - Frequently asked questions.</p> + +<p><b><a href="portability_guide.htm">Portability Guide</a></b> - Help for those +concerned with writing code to run on multiple operating systems.</p> + +<p><b><a href="deprecated.html">Deprecated Features</a></b> - Identifies +deprecated features and their replacements.</p> + +<p><b><a href="v3.html">Version 3 Introduction</a></b> - Aimed at users of prior +Boost.Filesystem versions.</p> + +<p><b><a href="v3_design.html">Version 3 Design</a></b> - Historical document +from the start of the Version 3 design process.</p> + +<p><b><a href="design.htm">Original Design</a></b> - Historical document from +the start of the Version 1 design process.</p> + +<p><b><a href="do_list.html">Do List</a></b> - Boost.Filesystem development work +in the pipeline.</p> + +<h2><a name="Using">Using</a> the library</h2> +<p>Boost.Filesystem is implemented as a separately compiled library, so you must install +binaries in a location that can be found by your linker. If you followed the +<a href="http://www.boost.org/doc/libs/release/more/getting_started/index.html">Boost Getting Started</a> instructions, that's already been done for you.</p> +<h2><a name="Coding-guidelines">Coding guidelines</a></h2> +<p>For new code, defining <code>BOOST_FILESYSTEM_NO_DEPRECATED</code> before +including filesystem headers is strongly recommended. This prevents inadvertent +use of old features, particularly legacy function names, that have been replaced +and are going to go away in the future.</p> +<h2><a name="Cautions">Cautions</a></h2> +<p>After reading the tutorial you can dive right into simple, +script-like programs using the Filesystem Library! Before doing any serious +work, however, there a few cautions to be aware of:</p> +<h4><b>Effects and Postconditions not guaranteed in the presence of race-conditions</b></h4> +<p>Filesystem function specifications follow the C++ Standard Library form, specifying behavior in terms of +effects and postconditions. If +a <a href="reference.html#Race-condition">race-condition</a> exists, a function's +postconditions may no longer be true by the time the function returns to the +caller.</p> +<blockquote> +<p><b><i>Explanation: </i></b>The state of files and directories is often +globally shared, and thus may be changed unexpectedly by other threads, +processes, or even other computers having network access to the filesystem. As an +example of the difficulties this can cause, note that the following asserts +may fail:</p> +<blockquote> +<p><code>assert( exists( "foo" ) == exists( "foo" ) ); // +(1)<br> +<br> +remove_all( "foo" );<br> +assert( !exists( "foo" ) ); // (2)<br> +<br> +assert( is_directory( "foo" ) == is_directory( "foo" ) ); // +(3)</code></p> +</blockquote> +<p>(1) will fail if a non-existent "foo" comes into existence, or an +existent "foo" is removed, between the first and second call to <i>exists()</i>. +This could happen if, during the execution of the example code, another thread, +process, or computer is also performing operations in the same directory.</p> +<p>(2) will fail if between the call to <i>remove_all()</i> and the call to +<i>exists()</i> a new file or directory named "foo" is created by another +thread, process, or computer.</p> +<p>(3) will fail if another thread, process, or computer removes an +existing file "foo" and then creates a directory named "foo", between the +example code's two calls to <i>is_directory()</i>.</p> +</blockquote> +<h4><b>May throw exceptions</b></h4> +<p>Unless otherwise specified, Boost.Filesystem functions throw <i> +<a href="reference.html#basic_filesystem_error-constructors">basic_filesystem_error</a></i> +exceptions if they cannot successfully complete their operational +specifications. Also, implementations may use C++ Standard Library functions, +which may throw <i>std::bad_alloc</i>. These exceptions may be thrown even +though the error condition leading to the exception is not explicitly specified +in the function's "Throws" paragraph.</p> +<p>All exceptions thrown by the Filesystem +Library are implemented by calling <a href="../../../utility/throw_exception.html"> +boost::throw_exception()</a>. Thus exact behavior may differ depending on +BOOST_NO_EXCEPTIONS at the time the filesystem source files are compiled.</p> +<p>Non-throwing versions are provided of several functions that are often used +in contexts where error codes may be the preferred way to report an error.</p> + +<h2><a name="Headers">Headers</a></h2> + +<p>The Boost.Filesystem library provides several headers:</p> + +<ul> + <li>Header <<a href="../../../../boost/filesystem.hpp">boost/filesystem.hpp</a>> + provides access to all features of the library, except file streams.<br> + </li> + <li>Header <<a href="../../../../boost/filesystem/fstream.hpp">boost/filesystem<i>/</i>fstream.hpp</a>> + inherits the same components as the C++ Standard + Library's <i>fstream</i> header, but files are identified by <code>const path&</code> + arguments rather that <code>const char*</code> arguments.</li> +</ul> +<h2><a name="Examples">Example programs</a></h2> +<p>See the <a href="tutorial.html">tutorial</a> for example programs.</p> +<h3>Other examples</h3> +<p>The programs used to generate the Boost regression test status tables use the +Filesystem Library extensively. See:</p> +<ul> + <li><a href="../../../../tools/regression/src/process_jam_log.cpp">process_jam_log.cpp</a></li> + <li><a href="../../../../tools/regression/src/compiler_status.cpp">compiler_status.cpp</a></li> +</ul> +<h2><a name="Implementation">Implementation</a></h2> +<p>The current implementation supports operating systems which provide +the POSIX or Windows API's.</p> +<p>The library is in regular use on Apple OS X, HP-UX, IBM AIX, Linux, +Microsoft Windows, SGI IRIX, and Sun Solaris operating systems using a variety +of compilers.</p> +<h2><a name="Macros">Macros</a></h2> +<p>Users may defined the following macros if desired. Sensible defaults are +provided, so users can ignore these macros unless they have special needs.</p> +<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111"> + <tr> + <td><b><i>Macro Name</i></b></td> + <td><b><i>Default</i></b></td> + <td><b><i>Effect if defined</i></b></td> + </tr> + <tr> + <td valign="top"><code>BOOST_FILESYSTEM_NO_DEPRECATED</code></td> + <td valign="top">Not defined.</td> + <td valign="top">Deprecated features are excluded from headers.</td> + </tr> + <tr> + <td valign="top"><code>BOOST_FILESYSTEM_DYN_LINK</code></td> + <td valign="top">Defined if <code>BOOST_ALL_DYN_LINK</code> is defined, + otherwise not defined.</td> + <td valign="top">The Boost.Filesystem library is dynamically linked. If not defined, + static linking is assumed.</td> + </tr> + <tr> + <td valign="top"><code>BOOST_FILESYSTEM_NO_LIB</code></td> + <td valign="top">Defined if <code>BOOST_ALL_NO_LIB</code> is defined, + otherwise not defined.</td> + <td valign="top">Boost.Filesystem library does not use the Boost auto-link + facility.</td> + </tr> + </table> +<p>User-defined BOOST_POSIX_API and BOOST_WINDOWS_API macros are no longer +supported.</p> +<h2><a name="Building">Building</a> the object-library</h2> +<p>The object-library will be built automatically if you are using the Boost +build system. See +<a href="../../../../more/getting_started.html">Getting Started</a>. It can also be +built manually using a <a href="../build/Jamfile.v2">Jamfile</a> +supplied in directory libs/filesystem/build, or the user can construct an IDE +project or make file which includes the object-library source files.</p> +<p>The object-library source files are +supplied in directory <a href="../src">libs/filesystem/src</a>. These source files implement the +library for POSIX or Windows compatible operating systems; no implementation is +supplied for other operating systems. Note that many operating systems not +normally thought of as POSIX systems, such as mainframe legacy +operating systems or embedded operating systems, support POSIX compatible file +systems and so will work with the Filesystem Library.</p> +<p>The object-library can be built for static or dynamic (shared/dll) linking. +This is controlled by the BOOST_ALL_DYN_LINK or BOOST_FILESYSTEM_DYN_LINK +macros. See the <a href="http://www.boost.org/development/separate_compilation.html">Separate +Compilation</a> page for a description of the techniques used.</p> +<h3>Note for <a name="Cgywin">Cygwin</a> users</h3> +<p> <a href="http://www.cygwin.com/">Cygwin</a> version 1.7 or later is +required because only versions of GCC with wide character strings are supported.</p> + +<p> The library's implementation code treats Cygwin as a Windows platform, and +thus uses the Windows API and uses Windows path syntax as the native path +syntax.</p> + +<h2><a name="Change-history">Version history</a></h2> + +<h3>Version 3</h3> + +<p>Boost <span style="background-color: #FFFF00">1.??.0 - ???, 2010</span> - Internationalization via single class <code>path</code>. +More uniform error handling.</p> + +<p>Peter Dimov suggested use of a single path class rather than a <code>basic_path</code> +class template. That idea was the basis for the Version 3 redesign.</p> + +<p>Thanks for comments from Robert Stewart, Zach Laine, Peter Dimov, Gregory +Peele, Scott McMurray, John Bytheway, Jeff Flinn, Jeffery Bosboom.</p> + +<h3>Version 2</h3> + +<p>Boost 1.34.0 - May, 2007 - Internationalization via <code>basic_path</code> +template.</p> + +<p>So many people have contributed comments and bug reports that it isn't any +longer possible to acknowledge them individually. That said, Peter Dimov and Rob +Stewart need to be specially thanked for their many constructive criticisms and +suggestions. Terence +Wilson and Chris Frey contributed timing programs which helped illuminate +performance issues.</p> + +<h3>Version 1</h3> + +<p>Boost 1.30.0 - March, 2003 - Initial official Boost release.</p> + +<p>The Filesystem Library was designed and implemented by Beman Dawes. The +original <i>directory_iterator</i> and <i>filesystem_error</i> classes were +based on prior work from Dietmar Kuehl, as modified by Jan Langer. Thomas Witt +was a particular help in later stages of initial development. Peter Dimov and +Rob Stewart made many useful suggestions and comments over a long period of +time. Howard Hinnant helped with internationalization issues.</p> + +<p>Key <a href="design.htm#Requirements">design requirements</a> and +<a href="design.htm#Realities">design realities</a> were developed during +extensive discussions on the Boost mailing list, followed by comments on the +initial implementation. Numerous helpful comments were then received during the +Formal Review.<p>Participants included +Aaron Brashears, +Alan Bellingham, +Aleksey Gurtovoy, +Alex Rosenberg, +Alisdair Meredith, +Andy Glew, +Anthony Williams, +Baptiste Lepilleur, +Beman Dawes, +Bill Kempf, +Bill Seymour, +Carl Daniel, +Chris Little, +Chuck Allison, +Craig Henderson, +Dan Nuffer, +Dan'l Miller, +Daniel Frey, +Darin Adler, +David Abrahams, +David Held, +Davlet Panech, +Dietmar Kuehl, +Douglas Gregor, +Dylan Nicholson, +Ed Brey, +Eric Jensen, +Eric Woodruff, +Fedder Skovgaard, +Gary Powell, +Gennaro Prota, +Geoff Leyland, +George Heintzelman, +Giovanni Bajo, +Glen Knowles, +Hillel Sims, +Howard Hinnant, +Jaap Suter, +James Dennett, +Jan Langer, +Jani Kajala, +Jason Stewart, +Jeff Garland, +Jens Maurer, +Jesse Jones, +Jim Hyslop, +Joel de Guzman, +Joel Young, +John Levon, +John Maddock, +John Williston, +Jonathan Caves, +Jonathan Biggar, +Jurko, +Justus Schwartz, +Keith Burton, +Ken Hagen, +Kostya Altukhov, +Mark Rodgers, +Martin Schuerch, +Matt Austern, +Matthias Troyer, +Mattias Flodin, +Michiel Salters, +Mickael Pointier, +Misha Bergal, +Neal Becker, +Noel Yap, +Parksie, +Patrick Hartling, Pavel Vozenilek, +Pete Becker, +Peter Dimov, +Rainer Deyke, +Rene Rivera, +Rob Lievaart, +Rob Stewart, +Ron Garcia, +Ross Smith, +Sashan, +Steve Robbins, +Thomas Witt, +Tom Harris, +Toon Knapen, +Victor Wagner, +Vincent Finn, +Vladimir Prus, and +Yitzhak Sapir + +<p>A lengthy discussion on the C++ committee's library reflector illuminated the "illusion +of portability" problem, particularly in postings by PJ Plauger and Pete Becker.</p> + +<p>Walter Landry provided much help illuminating symbolic link use cases for +version 1.31.0. </p> + +<hr> +<p>Revised +<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->20 February, 2011<!--webbot bot="Timestamp" endspan i-checksum="40524" --></p> + +<p>© Copyright Beman Dawes, 2002-2005</p> +<p> Use, modification, and distribution are subject to 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> + +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/path_table.cpp b/libs/filesystem/v3/doc/path_table.cpp new file mode 100644 index 0000000000..cb811cacfe --- /dev/null +++ b/libs/filesystem/v3/doc/path_table.cpp @@ -0,0 +1,260 @@ +// Generate an HTML table showing path decomposition ---------------------------------// + +// Copyright Beman Dawes 2005. + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// See http://www.boost.org/libs/filesystem for documentation. + +// For purposes of generating the table, support both POSIX and Windows paths + +#include "boost/filesystem.hpp" +#include <iostream> +#include <fstream> + +using boost::filesystem::path; +using std::string; +using std::cout; + +namespace +{ + std::ifstream infile; + std::ofstream posix_outfile; + std::ifstream posix_infile; + std::ofstream outfile; + + bool posix; + + const string empty_string; + + struct column_base + { + virtual string heading() const = 0; + virtual string cell_value( const path & p ) const = 0; + }; + + struct c0 : public column_base + { + string heading() const { return string("<code>string()</code>"); } + string cell_value( const path & p ) const { return p.string(); } + } o0; + + struct c1 : public column_base + { + string heading() const { return string("<code>generic_<br>string()</code>"); } + string cell_value( const path & p ) const { return p.generic_string(); } + } o1; + + struct c2 : public column_base + { + string heading() const { return string("Iteration<br>over<br>Elements"); } + string cell_value( const path & p ) const + { + string s; + for( path::iterator i(p.begin()); i != p.end(); ++i ) + { + if ( i != p.begin() ) s += ','; + s += (*i).string(); + } + return s; + } + } o2; + + struct c3 : public column_base + { + string heading() const { return string("<code>root_<br>path()</code>"); } + string cell_value( const path & p ) const { return p.root_path().string(); } + } o3; + + struct c4 : public column_base + { + string heading() const { return string("<code>root_<br>name()</code>"); } + string cell_value( const path & p ) const { return p.root_name().string(); } + } o4; + + struct c5 : public column_base + { + string heading() const { return string("<code>root_<br>directory()</code>"); } + string cell_value( const path & p ) const { return p.root_directory().string(); } + } o5; + + struct c6 : public column_base + { + string heading() const { return string("<code>relative_<br>path()</code>"); } + string cell_value( const path & p ) const { return p.relative_path().string(); } + } o6; + + struct c7 : public column_base + { + string heading() const { return string("<code>parent_<br>path()</code>"); } + string cell_value( const path & p ) const { return p.parent_path().string(); } + } o7; + + struct c8 : public column_base + { + string heading() const { return string("<code>filename()</code>"); } + string cell_value( const path & p ) const { return p.filename().string(); } + } o8; + + const column_base * column[] = { &o2, &o0, &o1, &o3, &o4, &o5, &o6, &o7, &o8 }; + + // do_cell ---------------------------------------------------------------// + + void do_cell( const string & test_case, int i ) + { + string temp = column[i]->cell_value(path(test_case)); + string value; + outfile << "<td>"; + if (temp.empty()) + value = "<font size=\"-1\"><i>empty</i></font>"; + else + value = string("<code>") + temp + "</code>"; + + if (posix) + posix_outfile << value << '\n'; + else + { + std::getline(posix_infile, temp); + if (value != temp) // POSIX and Windows differ + { + value.insert(0, "<br>"); + value.insert(0, temp); + value.insert(0, "<span style=\"background-color: #CCFFCC\">"); + value += "</span>"; + } + outfile << value; + } + outfile << "</td>\n"; + } + +// do_row ------------------------------------------------------------------// + + void do_row( const string & test_case ) + { + outfile << "<tr>\n"; + + if (test_case.empty()) + outfile << "<td><font size=\"-1\"><i>empty</i></font></td>\n"; + else + outfile << "<td><code>" << test_case << "</code></td>\n"; + + for ( int i = 0; i < sizeof(column)/sizeof(column_base&); ++i ) + { + do_cell( test_case, i ); + } + + outfile << "</tr>\n"; + } + +// do_table ----------------------------------------------------------------// + + void do_table() + { + outfile << + "<h1>Path Decomposition Table</h1>\n" + "<p>Shaded entries indicate cases where <i>POSIX</i> and <i>Windows</i>\n" + "implementations yield different results. The top value is the\n" + "<i>POSIX</i> result and the bottom value is the <i>Windows</i> result.\n" + "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n" + "<p>\n" + ; + + // generate the column headings + + outfile << "<tr><td><b>Constructor<br>argument</b></td>\n"; + + for ( int i = 0; i < sizeof(column)/sizeof(column_base&); ++i ) + { + outfile << "<td><b>" << column[i]->heading() << "</b></td>\n"; + } + + outfile << "</tr>\n"; + + // generate a row for each input line + + string test_case; + while ( std::getline( infile, test_case ) ) + { + if (!test_case.empty() && *--test_case.end() == '\r') + test_case.erase(test_case.size()-1); + if (test_case.empty() || test_case[0] != '#') + do_row( test_case ); + } + + outfile << "</table>\n"; + } + +} // unnamed namespace + +// main ------------------------------------------------------------------------------// + +#define BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE +#include <boost/test/included/prg_exec_monitor.hpp> + +int cpp_main( int argc, char * argv[] ) // note name! +{ + if ( argc != 5 ) + { + std::cerr << + "Usage: path_table \"POSIX\"|\"Windows\" input-file posix-file output-file\n" + "Run on POSIX first, then on Windows\n" + " \"POSIX\" causes POSIX results to be saved in posix-file;\n" + " \"Windows\" causes POSIX results read from posix-file\n" + " input-file contains the paths to appear in the table.\n" + " posix-file will be used for POSIX results\n" + " output-file will contain the generated HTML.\n" + ; + return 1; + } + + infile.open( argv[2] ); + if ( !infile ) + { + std::cerr << "Could not open input file: " << argv[2] << std::endl; + return 1; + } + + if (string(argv[1]) == "POSIX") + { + posix = true; + posix_outfile.open( argv[3] ); + if ( !posix_outfile ) + { + std::cerr << "Could not open POSIX output file: " << argv[3] << std::endl; + return 1; + } + } + else + { + posix = false; + posix_infile.open( argv[3] ); + if ( !posix_infile ) + { + std::cerr << "Could not open POSIX input file: " << argv[3] << std::endl; + return 1; + } + } + + outfile.open( argv[4] ); + if ( !outfile ) + { + std::cerr << "Could not open output file: " << argv[2] << std::endl; + return 1; + } + + outfile << "<html>\n" + "<head>\n" + "<title>Path Decomposition Table</title>\n" + "</head>\n" + "<body bgcolor=\"#ffffff\" text=\"#000000\">\n" + ; + + do_table(); + + outfile << "</body>\n" + "</html>\n" + ; + + return 0; +} diff --git a/libs/filesystem/v3/doc/path_table.txt b/libs/filesystem/v3/doc/path_table.txt new file mode 100644 index 0000000000..40809c6774 --- /dev/null +++ b/libs/filesystem/v3/doc/path_table.txt @@ -0,0 +1,50 @@ +# Paths for the reference.html Path Decomposition Table +# +# This is the input file for path_table, which generates the actual html +# +# Copyright Beman Dawes 2010 +# +# Distributed under the Boost Software License, Version 1.0. +# See www.boost.org/LICENSE_1_0.txt +# +# Note that an empty line is treated as input rather than as a comment + +. +.. +foo +/ +/foo +foo/ +/foo/ +foo/bar +/foo/bar +//net +//net/foo +///foo/// +///foo///bar +/. +./ +/.. +../ +foo/. +foo/.. +foo/./ +foo/./bar +foo/.. +foo/../ +foo/../bar +c: +c:/ +c:foo +c:/foo +c:foo/ +c:/foo/ +c:/foo/bar +prn: +c:\ +c:foo +c:\foo +c:foo\ +c:\foo\ +c:\foo/ +c:/foo\bar diff --git a/libs/filesystem/v3/doc/portability_guide.htm b/libs/filesystem/v3/doc/portability_guide.htm new file mode 100644 index 0000000000..458e5dc81a --- /dev/null +++ b/libs/filesystem/v3/doc/portability_guide.htm @@ -0,0 +1,241 @@ +<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>Portability Guide</title> +<link rel="stylesheet" type="text/css" href="../../../../doc/src/minimal.css"> +</head> + +<body bgcolor="#FFFFFF"> + +<h1> +<img border="0" src="../../../../boost.png" align="center" width="300" height="86">Path +Name Portability +Guide</h1> + +<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="100%"> + <tr> + <td><a href="index.htm">Filesystem Home</a> + <a href="release_history.html">Releases</a> + <a href="reference.html">Reference</a> + <a href="tutorial.html">Tutorial</a> + <a href="faq.htm">FAQ</a> + <a href="portability_guide.htm">Portability</a> + <a href="v3.html">V3 Intro</a> + <a href="v3_design.html">V3 Design</a> + <a href="deprecated.html">Deprecated</a> + </td> + </tr> +</table> + +<p> +<a href="#Introduction">Introduction</a><br> +<a href="#name_check_functions">name_check functions</a><br> +<a href="#recommendations">File and directory name recommendations</a></p> +<h2><a name="Introduction">Introduction</a></h2> +<p>Like any other C++ program which performs I/O operations, there is no +guarantee that a program using Boost.Filesystem will be portable between +operating systems. Critical aspects of I/O such as how the operating system +interprets paths are unspecified by the C and C++ Standards.</p> +<p>It is not possible to know if a file or directory name will be +valid (and thus portable) for an unknown operating system. There is always the possibility that an operating system could use +names which are unusual (numbers less than 4096, for example) or very +limited in size (maximum of six character names, for example). In other words, +portability is never absolute; it is always relative to specific operating +systems or +file systems.</p> +<p>It is possible, however, to know in advance if a directory or file name is likely to be valid for a particular +operating system. It is also possible to construct names which are +likely to be portable to a large number of modern and legacy operating systems.</p> + +<p>Almost all modern operating systems support multiple file systems. At the +minimum, they support a native file system plus a CD-ROM file system (Generally +ISO-9669, often with Juliet extensions).</p> + +<p>Each file system +may have its own naming rules. For example, modern versions of Windows support NTFS, FAT, FAT32, and ISO-9660 file systems, among others, and the naming rules +for those file systems differ. Each file system may also have +differing rules for overall path validity, such as a maximum length or number of +sub-directories. Some legacy systems have different rules for directory names +versus regular file names.</p> + +<p>As a result, Boost.Filesystem's <i>name_check</i> functions +cannot guarantee directory and file name portability. Rather, they are intended to +give the programmer a "fighting chance" to achieve portability by early +detection of common naming problems.</p> + +<h2><a name="name_check_functions">name_check functions</a></h2> + +<p>A <i>name_check</i> function +returns true if its argument is valid as a directory and regular file name for a +particular operating or file system. A number of these functions are provided.</p> + +<p>The <a href="#portable_name">portable_name</a> function is of particular +interest because it has been carefully designed to provide wide +portability yet not overly restrict expressiveness.</p> + +<table border="1" cellpadding="5" cellspacing="0"> + <tr> + <td align="center" colspan="2"><b>Library Supplied name_check Functions</b></td> + </tr> + <tr> + <td align="center"><b>Function</b></td> + <td align="center"><b>Description</b></td> + </tr> + <tr> + <td align="left" valign="top"><code><a name="portable_posix_name">portable_posix_name</a>(const + std::string&<i> name</i>)</code></td> + <td><b>Returns:</b> <i>true</i> if <code>!name.empty() && name</code> contains only the characters + specified in<i> Portable Filename Character Set</i> rules as defined in by + POSIX (<a href="http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap03.html">www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap03.html</a>).<br> + The allowed characters are <code>0-9</code>, <code>a-z</code>, <code>A-Z</code>, + <code>'.'</code>, <code>'_'</code>, and <code>'-'</code>.<p><b>Use:</b> + applications which must be portable to any POSIX system.</td> + </tr> + <tr> + <td align="left" valign="top"><code><a name="windows_name">windows_name</a>(const + std::string&<i> name</i>)</code></td> + <td><b>Returns:</b> <i>true</i> if <code>!name.empty() && name</code> contains + only the characters specified by the Windows platform SDK as valid + regardless of the file system <code>&& (name</code> is <code>"."</code> or + <code>".."</code> or does not end with a trailing space or period<code>)</code>. + The allowed characters are anything except <code>0x0-0x1F</code>, <code>'<'</code>, + <code>'>'</code>, <code>':'</code>, <code>'"'</code>, <code>'/'</code>, + <code>'\'</code>, and <code>'|'</code>.<p> + <b>Use:</b> applications which must be portable to Windows.</p> + <p><b>Note:</b> Reserved device names are not valid as file names, but are + not being detected because they are still valid as a path. Specifically, + CON, PRN, AUX, CLOCK$, NUL, COM[1-9], LPT[1-9], and these names followed by + an extension (for example, NUL.tx7).</td> + </tr> + <tr> + <td align="left" valign="top"><code><a name="portable_name">portable_name</a>(const + std::string&<i> name</i>)</code></td> + <td><b>Returns:</b> <code> windows_name(name) && portable_posix_name(name) + && (name</code> is <code>"."</code> or <code>".."</code>, and the first character not a period or hyphen<code>)</code>.<p><b>Use:</b> applications which must be portable to a wide variety of + modern operating systems, large and small, and to some legacy O/S's. The + first character not a period or hyphen restriction is a requirement of + several older operating systems.</td> + </tr> + <tr> + <td align="left" valign="top"><code><a name="portable_directory_name"> + portable_directory_name</a>(const std::string&<i> name</i>)</code></td> + <td><b>Returns:</b> <code>portable_name(name) && (name</code> is <code>"."</code> + or <code>".."</code> or contains no periods<code>)</code>.<p><b>Use:</b> applications + which must be portable to a wide variety of platforms, including OpenVMS.</td> + </tr> + <tr> + <td align="left" valign="top"><code><a name="portable_file_name"> + portable_file_name</a>(const std::string&<i> name</i>)</code></td> + <td><b>Returns:</b> <code>portable_name(name) && </code>any period is followed by one to three additional + non-period characters.<p><b>Use:</b> + applications which must be portable to a wide variety of platforms, + including OpenVMS and other systems which have a concept of "file extension" + but limit its length.</td> + </tr> + <tr> + <td align="left" valign="top"><code><a name="native">native</a>(const + std::string&<i> name</i>)</code></td> + <td><b>Returns:</b> Implementation defined. Returns <i> + true</i> for names considered valid by the operating system's native file + systems.<p><b>Note:</b> May return <i>true</i> for some names not considered valid + by the operating system under all conditions (particularly on operating systems which support + multiple file systems.)</td> + </tr> +</table> + +<h2>File and directory name <a name="recommendations">recommendations</a></h2> + +<table border="1" cellpadding="5" cellspacing="0"> + + <tr> + <td align="center" valign="top"><strong>Recommendation</strong></td> + <td align="center" valign="top"><strong>Rationale</strong></td> + </tr> + <tr> + <td valign="top">Limit file and directory names to the characters A-Z, a-z, 0-9, period, hyphen, and + underscore.<p>Use any of the "portable_" <a href="#name_check_functions"> + name check functions</a> to enforce this recommendation.</td> + <td valign="top">These are the characters specified by the POSIX standard for portable directory and + file names, and are also valid for Windows, Mac, and many other modern file systems.</td> + </tr> + <tr> + <td valign="top">Do not use a period or hyphen as the first + character of a name. Do not use period as the last character of a name.<p> + Use <a href="#portable_name">portable_name</a>, + <a href="#portable_directory_name">portable_directory_name</a>, or + <a href="#portable_file_name">portable_file_name</a> to enforce this + recommendation.</td> + <td valign="top">Some operating systems treat have special rules for the + first character of names. POSIX, for example. Windows does not permit period + as the last character.</td> + </tr> + <tr> + <td valign="top">Do not use periods in directory names.<p>Use + <a href="#portable_directory_name">portable_directory_name</a> to enforce + this recommendation.</td> + <td valign="top">Requirement for ISO-9660 without Juliet extensions, OpenVMS filesystem, and other legacy systems.</td> + </tr> + <tr> + <td valign="top">Do not use more that one period in a file name, and limit + the portion after the period to three characters.<p>Use + <a href="#portable_file_name">portable_file_name</a> to enforce this + recommendation.</td> + <td valign="top">Requirement for ISO-9660 level 1, OpenVMS filesystem, and + other legacy systems. </td> + </tr> + <tr> + <td valign="top">Do not assume names are case sensitive. For example, do not expected a directory to be + able to hold separate elements named "Foo" and "foo". </td> + <td valign="top">Some file systems are case insensitive. For example, Windows + NTFS is case preserving in the way it stores names, but case insensitive in + searching for names (unless running under the POSIX sub-system, it which + case it does case sensitive searches). </td> + </tr> + <tr> + <td valign="top">Do not assume names are case insensitive. For example, do not expect a file + created with the name of "Foo" to be opened successfully with the name of "foo".</td> + <td valign="top">Some file systems are case sensitive. For example, POSIX.</td> + </tr> + <tr> + <td valign="top">Don't use hyphens in names.</td> + <td valign="top">ISO-9660 level 1, and possibly some legacy systems, do not permit + hyphens.</td> + </tr> + <tr> + <td valign="top">Limit the length of the string returned by path::string() to + 255 characters. + Note that ISO 9660 has an explicit directory tree depth limit of 8, although + this depth limit is removed by the Juliet extensions.</td> + <td valign="top">Some operating systems place limits on the total path length. For example, + Windows 2000 limits paths to 260 characters total length.</td> + </tr> + <tr> + <td valign="top">Limit the length of any one name in a path. Pick the specific limit according to + the operating systems and or file systems you wish portability to:<br> + Not a concern:: POSIX, Windows, MAC OS X.<br> + 31 characters: Classic Mac OS<br> + 8 characters + period + 3 characters: ISO 9660 level 1<br> + 32 characters: ISO 9660 level 2 and 3<br> + 128 characters (64 if Unicode): ISO 9660 with Juliet extensions</td> + <td valign="top">Limiting name length can markedly reduce the expressiveness of file names, yet placing + only very high limits on lengths inhibits widest portability.</td> + </tr> +</table> + +<hr> +<p>Revised +<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->20 February, 2011<!--webbot bot="Timestamp" endspan i-checksum="40524" --></p> + +<p>© Copyright Beman Dawes, 2002, 2003</p> +<p> Use, modification, and distribution are subject to the Boost Software +License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt"> +LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> +www.boost.org/LICENSE_1_0.txt</a>)</p> + +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/reference.html b/libs/filesystem/v3/doc/reference.html new file mode 100644 index 0000000000..f700275015 --- /dev/null +++ b/libs/filesystem/v3/doc/reference.html @@ -0,0 +1,3672 @@ +<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 V3 Reference +</title> +<link rel="stylesheet" type="text/css" href="../../../../doc/src/minimal.css"> +<style type="text/css"> + pre {background-color:#D7EEFF} + body + { + font-family: sans-serif; + max-width : 8.5in; + margin: 1em; + } +</style> +</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">Filesystem Home</a> + <a href="release_history.html">Releases</a> + <a href="reference.html">Reference</a> + <a href="tutorial.html">Tutorial</a> + <a href="faq.htm">FAQ</a> + <a href="portability_guide.htm">Portability</a> + <a href="v3.html">V3 Intro</a> + <a href="v3_design.html">V3 Design</a> + <a href="deprecated.html">Deprecated</a> + </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 <code><boost/filesystem.hpp></code> synopsis</a><br> + <a href="#Error-reporting">Error reporting</a><br> + <a href="#class-path">Class <code>path</code></a><br> + <a href="#path-Conversions"><code>path</code> conversions</a><br> + <a href="#path-Conversions-to-native-format"><code>path</code> + conversions to native format</a><br> + <a href="#path-Conversions-to-generic-format"><code>path</code> + conversions to generic format</a><br> + <a href="#path-Encoding-conversions"><code>path</code> + encoding conversions</a><br> + <a href="#path-Requirements"><code>path</code> requirements</a><br> + <a href="#path-constructors"><code>path</code> constructors</a><br> + <a href="#path-assignments"><code>path</code> assignments</a><br> + <a href="#path-appends"><code>path</code> appends</a><br> + <a href="#path-modifiers"><code>path</code> modifiers</a><br> + <a href="#path-native-format-observers"><code>path</code> native + format observers</a><br> + <a href="#path-generic-format-observers"><code>path</code> generic + format observers</a><br> + <a href="#path-decomposition"><code>path</code> decomposition</a><br> + <a href="#path-query"><code>path</code> query</a><br> + <a href="#path-iterators"><code>path</code> iterators</a><br> + <a href="#path-deprecated-functions"><code>path</code> deprecated functions</a><br> + <a href="#path-non-member-functions"><code>path</code> non-member functions</a><br> + <a href="#path-inserter-extractor"><code>path</code> inserters and extractors</a><br> + <a href="#Class-filesystem_error">Class <code>filesystem_error</code></a><br> + <a href="#filesystem_error-members"><code>filesystem_error</code> + constructors</a><br> + <code>f</code><a href="#filesystem_error-path1"><code>ilesystem_error</code> path1</a><br> + <a href="#filesystem_error-path2"><code>filesystem_error</code> path2</a><br> + <a href="#filesystem_error-what"><code>filesystem_error</code><code> + </code>what</a></td> + <td width="33%" valign="top"> + <a href="#Enum-file_type">Enum <code>file_type</code></a><br> + <a href="#Enum-perms">Enum <code>perms</code></a><br> + <a href="#file_status">Class + <code>file_status</code></a><br> + + <a href="#file_status"> + <code>file_status</code></a><a href="#file_status-constructors"> constructors</a><br> + <code><a href="#file_status-modifiers">file_status-modifiers</a></code><a href="#directory_entry-observers"> observers</a><br> + <code><a href="#file_status-observers">file_status-observers</a></code><a href="#directory_entry-modifiers"> modifiers</a><br> +<a href="#Class-directory_entry">Class <code>directory_entry</code></a><br> + +<a href="#directory_entry-constructors"><code>directory_entry</code> constructors</a><br> + <a href="#directory_entry-observers"><code>directory_entry</code> observers</a><br> + <a href="#directory_entry-modifiers"><code>directory_entry</code> modifiers</a><br> +<a href="#Class-directory_iterator">Class <code>directory_iterator</code></a><br> + <a href="#directory_iterator-members"><code>directory_iterator</code> + members</a><br> +<a href="#Class-recursive_directory_iterator">Class <code>recursive_directory_iterator</code></a><br> + <a href="#Operational-functions"> + Operational functions</a><br> + <code>   <a href="#absolute">absolute</a><br> + <a href="#canonical">canonical</a><br> + <a href="#copy">copy</a><br> + <a href="#copy_directory">copy_directory</a><br> + <a href="#copy_file">copy_file</a><br> + <a href="#copy_symlink">copy_symlink</a><br> +   <a href="#create_directories">create_directories</a><br> +   <a href="#create_directory">create_directory</a><br> +   <a href="#create_hard_link">create_hard_link</a><br> +   <a href="#create_symlink">create_symlink</a><br> +   <a href="#current_path">current_path</a><br> +   <a href="#exists">exists</a><br> +   <a href="#equivalent">equivalent</a><br> +   <a href="#file_size">file_size</a><br> + <a href="#hard_link_count">hard_link_count</a><br> + <a href="#initial_path">initial_path</a><br> +   i<a href="#is_directory">s_directory</a><br> +   <a href="#is_empty">is_empty</a></code></td> + <td width="34%" valign="top"> + <code>   <a href="#is_other">is_other</a><br> +   <a href="#is_regular_file">is_regular_file</a><br> +   <a href="#is_symlink">is_symlink</a><br> +   <a href="#last_write_time">last_write_time</a><br> + permissions<br> + <a href="#read_symlink">read_symlink</a><br> +   <a href="#remove">remove</a><br> +   <a href="#remove_all">remove_all</a><br> +   <a href="#rename">rename</a><br> + <a href="#resize_file">resize_file</a><br> +   <a href="#space">space</a><br> +   <a href="#status">status</a><br> +   <a href="#status_known">status_known</a><br> +   <a href="#symlink_status">symlink_status</a><br> +   <a href="#system_complete">system_complete</a><br> +   <a href="#temp_directory_path">temp_directory_path</a><br> + </code> <code> <a href="#unique_path">unique_path</a></code><br> + <a href="#File-streams">File streams</a><br> +<a href="#Path-decomposition-table">Path decomposition table</a><br> + <a href="#long-path-warning">Warning: Long paths on Windows and the + extended-length <b>\\?\ </b>prefix</a><br> +<a href="#Acknowledgements">Acknowledgements</a><br> +<a href="#References">References</a><br> + </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 +0x00 +characters are not permitted. Implementations may define additional +characters or specific names that are not permitted. Filenames <code>.</code> +and <code>..</code> have special meaning. Implementations may define +additional filenames that have special meaning.</p> +<blockquote> + <p><i>[Note:</i> Most operating systems prohibit the ASCII control characters + (0x00-0x1F) in filenames.</p> + <p>Windows prohibits the characters 0x00-0x1F, <code>"</code>,<code> + *</code>,<code> :</code>,<code> <</code>,<code> ></code>,<code> ?</code>,<code> + \</code>,<code> /</code>, and<code> |</code> <i>--end note]</i></p> +</blockquote> +<p><b><i><a name="Path">Path</a>:</i></b> A sequence of elements that identify +the location of a file within a filesystem. The elements are the <i>root-name<sub>opt</sub></i>, <i> +root-directory<sub>opt</sub></i>, and an optional sequence of filenames. [<i>Note:</i> +A <a href="#Pathname">pathname</a> is the concrete representation of a path. <i>--end note</i>]</p> +<p><b><i><a name="Absolute-path">Absolute path</a>:</i></b> A path that +unambiguously +identifies the location of a file within a filesystem without reference to an +additional starting location. 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. <i>--end + note]</i></p> +</blockquote> +<p><b><a name="Relative-path">Relative path</a>:</b> A path that only +unambiguously +identifies the location of a file within a filesystem when resolved relative to +a starting location. The format is implementation defined. [<i>Note:</i> +Paths "." and ".." are considered to be relative paths. <i>--end note</i>]</p> +<p><b><a name="Canonical-path">Canonical path</a>:</b> An absolute path that has +no elements which are symbolic links, and no dot or dot dot elements.</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 +implementation defined +native pathname format.</p> +<p><b><i><a name="generic-pathname-format">Generic pathname format:</a></i></b></p> +<blockquote> +<p><i>pathname:<br> + root-name<sub>opt</sub> +root-directory<sub>opt</sub> relative-path<sub>opt</sub></i></p> +<p><i>root-name:<br> + +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>":"</code> as a root-name identifying a disc drive. <i>--end note</i>]</p> + </blockquote> +</blockquote> +<p><i>root-directory:<br> + +directory-separator</i></p> +<p><i>relative-path:<br> + +filename<br> + relative-path +directory-separator<br> + relative-path +directory-separator filename</i></p> +<p><i>filename:<br> + name<br> + </i><code>"."</code><i><br> + </i><code> +".."</code></p> +<p><i>directory-separator:<br> + <code>"/"<br> + "/"</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>"."</code> is considered to be a reference to the current directory. The +<i>filename</i> <code>".."</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> +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 +"dangling" 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>"."</code> +and <code>".."</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 "as if" 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>Implementations are not required to provide behavior that is not supported by +a particular file system.</p> +<blockquote> +<p>[<i>Example:</i> The <a href="http://en.wikipedia.org/wiki/FAT_filesystem"> +FAT file system</a> used by some memory cards, camera memory, and floppy discs +does not support hard links, symlinks, and many other features of more capable +file systems. Implementations are only required to support the FAT features +supported by the host operating system. <i>-- end example</i>]</p> +</blockquote> +<p>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 users and implementers. No slight to other operating systems is implied +or intended. When unlikely to cause confusion, the term <i>POSIX</i> is +sometimes used to refer to "POSIX-compliant operating systems".</p> +<p>The behavior 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><boost/filesystem.hpp></code> synopsis</a></h2> +<pre> namespace boost + { + namespace filesystem + { + class <a href="#class-path">path</a>; + + void swap(path& lhs, path& rhs); + bool lexicographical_compare(path::iterator first1, path::iterator last1, + path::iterator first2, path::iterator last2); + std::size_t <a href="#hash_value">hash_value</a>(const path& p); + + bool operator==(const path& lhs, const path& rhs); + bool operator!=(const path& lhs, const path& rhs); + bool operator< (const path& lhs, const path& rhs); + bool operator<=(const path& lhs, const path& rhs); + bool operator> (const path& lhs, const path& rhs); + bool operator>=(const path& lhs, const path& rhs); + + path operator/ (const path& lhs, const path& rhs); + + std::ostream& operator<<( std::ostream& os, const path& p ); + std::wostream& operator<<( std::wostream& os, const path& p ); + std::istream& operator>>( std::istream& is, path& p ); + std::wistream& operator>>( std::wistream& is, path& p ) + + class <a href="#Class-filesystem_error">filesystem_error</a>; + class <a href="#Class-directory_entry">directory_entry</a>; + + class <a href="#Class-directory_iterator">directory_iterator</a>; + + class <a href="#Class-recursive_directory_iterator">recursive_directory_iterator</a>; + + enum <a name="file_type" href="#Enum-file_type">file_type</a> + { + status_error, file_not_found, regular_file, directory_file, + symlink_file, block_file, character_file, fifo_file, socket_file, + type_unknown + }; + + enum <a href="#Enum-perms">perms</a> + { + no_perms, + owner_read, owner_write, owner_exe, owner_all, + group_read, group_write, group_exe, group_all, + others_read, others_write, others_exe, others_all, all_all, + set_uid_on_exe, set_gid_on_exe, sticky_bit, + perms_mask, perms_not_known, + add_perms, remove_perms, symlink_perms + }; + + class <a href="#file_status">file_status</a>; + + struct <a name="space_info">space_info</a> // returned by <a href="#space" style="text-decoration: none">space</a> function + { + uintmax_t capacity; + uintmax_t free; + uintmax_t available; // free space available to a non-privileged process + }; + + BOOST_SCOPED_ENUM_START(<a name="copy_option">copy_option</a>) + { + none + fail_if_exists = none, + overwrite_if_exists + }; + BOOST_SCOPED_ENUM_END + + BOOST_SCOPED_ENUM_START(<a name="symlink_option">symlink_option</a>) + { + none + no_recurse = none, + recurse + }; + BOOST_SCOPED_ENUM_END + + // <a href="#Operational-functions">operational functions</a> + + path <a href="#absolute">absolute</a>(const path& p, const path& base=current_path()); + + path <a href="#canonical">canonical</a>(const path& p, const path& base = current_path()); + path <a href="#canonical">canonical</a>(const path& p, system::error_code& ec); + path <a href="#canonical">canonical</a>(const path& p, const path& base, system::error_code& ec); + + void <a href="#copy">copy</a>(const path& from, const path& to); + void <a href="#copy">copy</a>(const path& from, const path& to, system::error_code& ec); + + void <a href="#create_directory">copy_directory</a>(const path& from, const path& to); + void <a href="#create_directory">copy_directory</a>(const path& from, const path& to, system::error_code& ec); + + void <a href="#copy_file">copy_file</a>(const path& from, const path& to); + void <a href="#copy_file">copy_file</a>(const path& from, const path& to, system::error_code& ec); + void <a href="#copy_file">copy_file</a>(const path& from, const path& to, BOOST_SCOPED_ENUM(<a href="#copy_option">copy_option</a>) option); + void <a href="#copy_file">copy_file</a>(const path& from, const path& to, BOOST_SCOPED_ENUM(<a href="#copy_option">copy_option</a>) option, + system::error_code& ec); + + void <a href="#copy_symlink">copy_symlink</a>(const path& existing_symlink, const path& new_symlink); + void <a href="#copy_symlink">copy_symlink</a>(const path& existing_symlink, const path& new_symlink, system::error_code& ec); + + bool <a href="#create_directories">create_directories</a>(const path& p); + bool <a href="#create_directories">create_directories</a>(const path& p, system::error_code& ec); + + bool <a href="#create_directory">create_directory</a>(const path& p); + bool <a href="#create_directory">create_directory</a>(const path& p, system::error_code& ec); + + void <a href="#create_directory_symlink">create_directory_symlink</a>(const path& to, const path& new_symlink); + void <a href="#create_directory_symlink">create_directory_symlink</a>(const path& to, const path& new_symlink, system::error_code& ec); + + void <a href="#create_hard_link">create_hard_link</a>(const path& to, const path& new_hard_link); + void <a href="#create_hard_link">create_hard_link</a>(const path& to, const path& new_hard_link, system::error_code& ec); + + void <a href="#create_symlink">create_symlink</a>(const path& to, const path& new_symlink); + void <a href="#create_symlink">create_symlink</a>(const path& to, const path& new_symlink, system::error_code& ec); + + path <a href="#current_path">current_path</a>(); + path <a href="#current_path">current_path</a>(system::error_code& ec); + void <a href="#current_path">current_path</a>(const path& p); + void <a href="#current_path">current_path</a>(const path& p, system::error_code& ec); + + bool <a href="#exists">exists</a>(file_status s); + bool <a href="#exists">exists</a>(const path& p); + bool <a href="#exists">exists</a>(const path& p, system::error_code& ec); + + bool <a href="#equivalent">equivalent</a>(const path& p1, const path& p2); + bool <a href="#equivalent">equivalent</a>(const path& p1, const path& p2, system::error_code& ec); + + uintmax_t <a href="#file_size">file_size</a>(const path& p); + uintmax_t <a href="#file_size">file_size</a>(const path& p, system::error_code& ec); + uintmax_t <a href="#hard_link_count">hard_link_count</a>(const path& p); + uintmax_t <a href="#hard_link_count">hard_link_count</a>(const path& p, system::error_code& ec); + + const path& <a href="#initial_path">initial_path</a>(); + const path& <a href="#initial_path">initial_path</a>(<code>system::error_code& ec</code>); + + bool <a href="#is_directory">is_directory</a>(file_status s); + bool <a href="#is_directory2">is_directory</a>(const path& p); + bool <a href="#is_directory2">is_directory</a>(const path& p, system::error_code& ec); + + bool <a href="#is_empty">is_empty</a>(const path& p); + bool <a href="#is_empty">is_empty</a>(const path& p, system::error_code& ec); + + bool <a href="#is_other">is_other</a>(file_status s); + bool <a href="#is_other2">is_other</a>(const path& p,); + bool <a href="#is_other2">is_other</a>(const path& p, system::error_code& 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& p); + bool i<a href="#is_regular_file2">s_regular_file</a>(const path& p, system::error_code& ec); + + bool <a href="#is_symlink">is_symlink</a>(file_status s); + bool <a href="#is_symlink2">is_symlink</a>(const path& p); + bool <a href="#is_symlink2">is_symlink</a>(const path& p, system::error_code& ec); + + std::time_t <a href="#last_write_time">last_write_time</a>(const path& p); + std::time_t <a href="#last_write_time">last_write_time</a>(const path& p, system::error_code& ec); + void <a href="#last_write_time2">last_write_time</a>(const path& p, const std::time_t new_time); + void <a href="#last_write_time2">last_write_time</a>(const path& p, const std::time_t new_time, system::error_code& ec); + + path <a href="#read_symlink">read_symlink</a>(const path& p); + path <a href="#read_symlink">read_symlink</a>(const path& p, system::error_code& ec); + + bool <a href="#remove">remove</a>(const path& p); + bool <a href="#remove">remove</a>(const path& p, system::error_code& ec); + + uintmax_t <a href="#remove_all">remove_all</a>(const path& p); + uintmax_t <a href="#remove_all">remove_all</a>(const path& p, system::error_code& ec); + + void <a href="#rename">rename</a>(const path& from, const path& to); + void <a href="#rename">rename</a>(const path& from, const path& to, system::error_code& ec); + + void <a href="#resize_file">resize_file</a>(const path& p, uintmax_t size); + void <a href="#resize_file2">resize_file</a>(const path& p, uintmax_t size, system::error_code& ec); + + <a href="#space_info">space_info</a> <a href="#space">space</a>(const path& p); + <a href="#space_info">space_info</a> <a href="#space">space</a>(const path& p, system::error_code& ec); + <a href="#file_status">file_status</a> <a href="#status">status</a>(const path& p); + <a href="#file_status">file_status</a> <a href="#status">status</a>(const path& p, system::error_code& 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& p); + <a href="#file_status">file_status</a> <a href="#symlink_status">symlink_status</a>(const path& p, system::error_code& ec); + + path <a href="#system_complete">system_complete</a>(const path& p); + path <a href="#system_complete">system_complete</a>(const path& p, system::error_code& ec); + + path <a href="#temp_directory_path">temp_directory_path</a>(); + path <a href="#temp_directory_path">temp_directory_path</a>(system::error_code& ec); + + path <a href="#unique_path">unique_path</a>(const path& model="%%%%-%%%%-%%%%-%%%%"); + path <a href="#unique_path">unique_path</a>(const path& model, system::error_code& 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> + </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&</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> + </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> + </li> + <li>Destructors throw nothing.</li> + </ul> + <p>Functions having an argument of type +<code>system::error_code&</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&</code> argument is set as + appropriate appropriate for the specific error. Otherwise, <code>clear()</code> + is called on the +<code>system::error_code&</code> argument.<br> + </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 does not necessarily exist in external storage, and the +pathname is not necessarily valid for the current operating +system or for a particular file system.</p> +<blockquote> +<p>[<i>Example:</i> A <a href="#long-path-warning">long path name on Windows</a> +is an example of an innocuous appearing path that is not actually valid. <i>-- +end example</i>]</p> +</blockquote> +<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<value_type> string_type; + typedef std::codecvt<wchar_t, char, std::mbstate_t> codecvt_type; + + // <a href="#path-constructors">constructors</a> and destructor + path(); + path(const path& p); + + template <class <a href="#Source">Source</a>> + path(Source const& source, const codecvt_type& cvt=codecvt()); + + template <class <a href="#InputIterator">InputIterator</a>> + path(InputIterator begin, InputIterator end, const codecvt_type& cvt=codecvt()); + + ~path(); + + // <a href="#path-assignments">assignments</a> + path& operator=(const path& p); + + template <class <a href="#Source">Source</a>> + path& operator=(Source const& source); + + template <class <a href="#Source">Source</a>> + path& assign(Source const& source, const codecvt_type& cvt) + + template <class <a href="#InputIterator">InputIterator</a>> + path& assign(InputIterator begin, InputIterator end, const codecvt_type& cvt=codecvt()); + + // <a href="#path-appends">appends</a> + path& operator/=(const path& p); + + template <class <a href="#Source">Source</a>> + path& operator/=(Source const& source); + + template <class <a href="#Source">Source</a>> + path& append(Source const& source, const codecvt_type& cvt); + + template <class <a href="#InputIterator">InputIterator</a>> + path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt=codecvt()); + + // <a href="#path-modifiers">modifiers</a> + void <a href="#path-clear">clear</a>(); + path& <a href="#absolute">make_absolute</a>(const path& base); + path& <a href="#path-make_preferred">make_preferred</a>(); // POSIX: no effect. Windows: convert slashes to backslashes + path& <a href="#path-remove_filename">remove_filename</a>(); + path& <a href="#path-replace_extension">replace_extension</a>(const path& new_extension = path()); + void <a href="#path-swap">swap</a>(path& rhs); + + // <a href="#path-native-format-observers">native format observers</a> + const string_type& <a href="#native">native</a>() const; // native format, encoding + const value_type* <a href="#c_str">c_str</a>() const; // native().c_str() + + template <class String> + String <a href="#string-template">string</a>(const codecvt_type& cvt=codecvt()) const; // native format + + const string <a href="#string">string</a>(const codecvt_type& cvt=codecvt()) const; // native format + const wstring <a href="#wstring">wstring</a>(const codecvt_type& cvt=codecvt()) const; // ditto + const u16string <a href="#u16string">u16string</a>() const; // ditto + const u32string <a href="#u32wstring">u32string</a>() const; // ditto + + // <a href="#path-generic-format-observers">generic format observers</a> + template <class String> + String <a href="#generic_string-template">generic_string</a>() const; + + const string <a href="#generic_string">generic_string</a>(const codecvt_type& cvt=codecvt()) const; // generic format + const wstring <a href="#generic_wstring">generic_wstring</a>(const codecvt_type& cvt=codecvt()) const; // ditto + const u16string <a href="#generic_u16string">generic_u16string</a>() const; // ditto + const u32string <a href="#generic_u32wstring">generic_u32string</a>() 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; + + // <a href="#path_encoding">encoding conversion</a> + static std::locale <a href="#path-imbue">imbue</a>( const std::locale& loc ); + static const codecvt_type & <a href="#path-codecvt">codecvt</a>(); + + 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 +<code>typedef</code> for the +character type used by the operating system to represent pathnames.</p> +<p>Member functions described as returning <code>const string</code>, <code> +const wstring</code>, <code>const u16string</code>, or <code>const u32string</code> are permitted to return <code>const string&</code>, <code>const +wstring&</code>, <code>const u16string&</code>, or <code>const u32string&</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> +<h3><a name="path-Conversions"><code>path</code> Conversions</a></h3> +<h4><a name="path-Conversions-to-native-format"><code>path</code> Conversions to +native format</a></h4> +<p>Member function arguments that take character sequences representing paths +may use the <a href="#generic-pathname-format">generic pathname format</a> or +the <a href="#native-pathname-format">native pathname format</a>. If such an +argument uses the generic format, an implementation defined conversion to native format is performed +during the processing of the argument. </p> +<blockquote> +<p>[<i>Note:</i> No conversion occurs on POSIX and Windows since they have +native formats that conform to the generic format. <i>--end note</i>]</p> +<p>[<i>Rationale:</i> There is no unambiguous way for an implementation to +always be able distinguish between native format and generic format arguments. +This is by design as it simplifies use. Should an implementation encounter an +operating system where disambiguation is required, an implementation defined +native format prefix can be introduced to identify the native format. <i>-- end +rationale</i>]</p> +</blockquote> + +<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> + +<p>If the native format requires +paths for regular files to be formatted differently from paths for directories, the +path shall be treated as a directory path if last element is a separator, +otherwise it shall be treated as a regular file path.</p> + +<blockquote> + +<p>[<i>Note</i>: The above paragraph does not apply to POSIX and Windows since +they use the same format +for both regular file and directory pathnames. <i>--end note</i>]</p> + +<p>[<i>Example:</i> +On <a href="http://en.wikipedia.org/wiki/OpenVMS">OpenVMS</a>, a path +constructed from <code>"/cats/jane"</code> would considered a regular file +path, and have a native format of <code>"[CATS]JANE"</code>, while a +path constructed from <code>"/cats/jane/"</code> would be considered a +directory path, and have a native format of <code>"[CATS.JANE]"</code>. +<i>--end example</i>]</p> + +</blockquote> +<h4><a name="path-Conversions-to-generic-format"><code>path</code> Conversions +to generic format</a></h4> +<p><a href="#path-generic-format-observers">Generic format observer</a> +functions return strings formatted according to the +<a href="#generic-pathname-format">generic pathname format</a>. The conversion +from generic to native formats is implementation defined.</p> +<blockquote> +<p>[<i>Note:</i> For POSIX, no conversion is performed. For Windows, backslashes are converted to +forward slashes. <i>-- end note</i>]</p> +</blockquote> +<h4><a name="path-Encoding-conversions"><code>path</code> Encoding conversions</a></h4> +<p>If the value type of member function arguments that are character sequences +representing paths is not <code>value_type</code>, +and no <code>cvt</code> argument is supplied, conversion to <code>value_type</code> +occurs using an imbued locale. This imbued locale is initialized with a <code> +codecvt</code> facet appropriate for the operating system.</p> +<blockquote> +<p>For Apple OS X implementations, <code>path::value_type</code> +is <code>char</code>. The default imbued locale provides a UTF-8 <code>codecvt</code> +facet. [<i>Rationale:</i> "All BSD system functions expect their string +parameters to be in UTF-8 encoding and nothing else." See +<a href="http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html"> +Apple docs</a>. <i>-- end rationale</i>]</p> +<p>For Windows-like implementations, including +<a href="http://www.mingw.org/">MinGW</a>, <code>path::value_type</code> is <code> +wchar_t</code>. The default imbued locale provides a <code>codecvt</code> facet +that invokes Windows <code>MultiByteToWideChar</code> or <code> +WideCharToMultiByte</code> API with a codepage of <code>CP_THREAD_ACP</code> +if Windows <code>AreFileApisANSI()</code>is true, otherwise codepage <code> +CP_OEMCP</code>. [<i>Rationale:</i> this is the current behavior of C and C++ +programs that perform file operations using narrow character string to identify +paths. Changing this in the Filesystem library would be too surprising, +particularly where user input is involved. <i>-- end rationale</i>]</p> +<p>For all other implementations, including<b> </b>Linux, <code>path::value_type</code> +is <code>char</code>. The default imbued locale is <code>std::locale("")</code>. +[<i>Rationale:</i> ISO C specifies this as "the locale-specific native +environment", while POSIX says it "Specifies an implementation-defined native +environment." <i>-- end rationale</i>]</p> +</blockquote> +<h3><a name="path-Requirements"><code>path</code> Requirements</a></h3> +<p>Template parameters named <code><a name="InputIterator">InputIterator</a></code> +are 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>Template parameters named <code><a name="Source">Source</a></code> are 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> + +<h3> <a name="path-constructors"> <code> +<font size="4">path</font></code> constructors</a></h3> +<pre><span style="background-color: #D7EEFF">path();</span></pre> +<blockquote> + <p><i>Postcondition:</i> <code>empty()</code>.</p> + </blockquote> +<pre>template <class <a href="#Source">Source</a>> + path(Source const& source, const codecvt_type& cvt=codecvt());</pre> +<pre>template <class <a href="#InputIterator">InputIterator</a>> + path(InputIterator begin, InputIterator end, const codecvt_type& 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 and the generic format is unacceptable to the operating + system's API, they are converted to the native format. [<i>Note:</i> For + POSIX and Windows 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 [<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 <class <a href="#Source">Source</a>> + path& operator=(Source const& source);</pre> +<pre>template <class <a href="#Source">Source</a>> + path& assign(Source const& source, const codecvt_type& cvt);</pre> +<pre>template <class <a href="#InputIterator">InputIterator</a>> + path& assign(InputIterator begin, InputIterator end, const codecvt_type& 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 [<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& operator/=(const path& 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 <class <a href="#Source">Source</a>> + path& operator/=(Source const & source);</pre> +<pre>template <class <a href="#Source">Source</a>> + path& append(Source const & source, const codecvt_type& cvt);</pre> +<pre>template <class <a href="#InputIterator">InputIterator</a>> + path& append(InputIterator begin, InputIterator end, const codecvt_type& 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 [<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->empty()</code> is true.</p> +</blockquote> +<pre>path& <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& <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> <i>-- end + note</i>]</p> +</blockquote> +<pre>path& <a name="path-replace_extension">replace_extension</a>(const path& 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>void <a name="path-swap">swap</a>(path& rhs);</code></pre> +<blockquote> + <p><i>Effects:</i> + Swaps the contents of the two paths.</p> + <p><i>Throws: </i> + nothing.</p> + <p><i>Complexity: </i> + constant time.</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& <a name="native">native</a>() const;</pre> +<blockquote> +<p><i>Returns:</i> <code>pathname</code>.</p> +<p><i>Throws:</i> nothing.</p> +</blockquote> +<pre>const value_type* <a name="c_str">c_str</a>() const;</pre> +<blockquote> +<p><i>Returns:</i> <code>pathname.c_str()</code>.</p> +<p><i>Throws:</i> nothing.</p> +</blockquote> +<pre>template <class String> +String <a name="string-template">string</a>(const codecvt_type& 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 <a name="string">string</a>(const codecvt_type& cvt=codecvt()) const; +const wstring <a name="wstring">wstring</a>(const codecvt_type& cvt=codecvt()) const; +const u16string <a name="u16string">u16string</a>() const; +const u32wstring <a name="u32wstring">u32wstring</a>() 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&</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 <class String> +String <a name="generic_string-template">generic_string</a>(const codecvt_type& 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 <a name="generic_string">generic_string</a>(const codecvt_type& cvt=codecvt()) const; +const wstring <a name="generic_wstring">generic_wstring</a>(const codecvt_type& cvt=codecvt()) const; +const u16string <a name="generic_u16string">generic_u16string</a>() const; +const u32wstring <a name="generic_u32wstring">generic_u32wstring</a>() 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 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&</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 << path("/foo/bar.txt").filename();</code> // outputs "<code>bar.txt</code>"</pre> + </blockquote> + <p> <i>--end example</i>]</p> +</blockquote> +<pre>path <a name="path-stem">stem</a>(const path& 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 << path("/foo/bar.txt").stem();</code> // outputs "<code>bar</code>" +path p = "foo.bar.baz.tar"; +for (; !p.extension().empty(); p = p.stem()) + std::cout << p.extension() << '\n'; + // outputs: .tar + // .baz + // .bar</pre> + </blockquote> + <p> <i>--end example</i>]</p> +</blockquote> +<pre>path <a name="path-extension">extension</a>(const path& 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 << path("/foo/bar.txt").extension(); //</code> outputs "<code>.txt</code>"</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. <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><i>Returns:</i> <code>true</code> + if the elements of <code>root_path()</code> uniquely identify a directory, else <code>false</code>.</p> + <p>[<i>Note:</i> On POSIX,<code> + path("/foo").is_absolute()</code> returns <code>true</code>. On Windows, <code> + path("/foo").is_absolute()</code> returns <code>false</code>. <i>--end note</i>]</p> +</blockquote> +<pre>bool <a name="path-is_relative">is_relative</a>() const;</pre> +<blockquote> + <p><i>Returns:</i> <code>!is_absolute()</code>.</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_encoding"><code><font size="4"> path</font></code> encoding</a> conversion</h3> + <pre>static std::locale <a name="path-imbue">imbue</a>(const std::locale& loc);</pre> +<blockquote> + <p><i>Effects:</i> Stores <code>loc</code> as the default locale for all + objects of type <code>path</code>.</p> + <p><i>Returns:</i> The previous default locale for all objects of type <code> + path</code>.</p> +</blockquote> +<pre>static const codecvt_type& <a name="path-codecvt">codecvt</a>();</pre> +<blockquote> + <p><i>Returns:</i> The <code>codecvt</code> facet for the default locale for + all objects of type <code>path</code>.</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& 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> +non-member functions</a></h3> +<pre>void swap( path& lhs, path& rhs )</pre> +<blockquote> + <p><i>Effects: </i><code> + lhs.swap(rhs)</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 && first2 != last2 ; ++first1, ++first2) { + if (first1->native() < first2->native()) return true; + if (first2->native() < first1->native()) return false; + } + return first1 == last1 && 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>std::size_t <a name="hash_value">hash_value</a> (const path& p);</pre> +<blockquote> + <p><i>Returns:</i> A hash value for the path <code>p</code>. If + for two paths, <code>p1 == p2</code> then + <code>hash_value(p1) == hash_value(p2)</code>.</p> + <p>This allows paths to be used with + <a href="../../../functional/hash/index.html">Boost.Hash</a>.</p> +</blockquote> +<pre>bool operator< (const path& lhs, const path& 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<=(const path& lhs, const path& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>!(rhs < lhs)</code>.</p> +</blockquote> +<pre>bool operator> (const path& lhs, const path& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>rhs < lhs</code>.</p> +</blockquote> +<pre>bool operator>=(const path& lhs, const path& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>!(lhs < rhs)</code>.</p> +</blockquote> +<pre>bool operator==(const path& lhs, const path& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>!(lhs < rhs) && !(rhs < 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("foo") == "bar"</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("foo", "bar")</code> will be <code>true</code> + when both paths resolve to the same file.</p> + <p>Programmers wishing to determine if two paths are "the same" must decide if + "the same" means "the same representation" or "resolve to the same actual + file", and choose the appropriate function accordingly. <i> + -- end note</i>]</p> +</blockquote> +<pre>bool operator!=(const path& lhs, const path& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>!(lhs == rhs)</code>.</p> +</blockquote> +<pre>path operator/ (const path& lhs, const path& 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"> inserter + and extractor</a></h3> +<p> The inserter and extractor delimit the string with double-quotes (<code>"</code>) +to ensure that paths with embedded spaces will round trip correctly. Ampersand (<code>&</code>) +is used as an escape character, so the path can itself contain double quotes.</p> +<pre>template <class Char, class Traits> +std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, + const path& p) +</pre> +<blockquote> + <p><i>Effects:</i> + <code>os << <a href="../../../io/doc/quoted_manip.html"> + boost::io::quoted</a>(p.string<std::basic_string<Char>>(), static_cast<Char>('&'));</code></p> + <p><i>Returns:</i> + <code>os</code></p> +</blockquote> +<pre>template <class Char, class Traits> +inline std::basic_istream<Char, Traits>& operator>>(std::basic_istream<Char, Traits>& is, + path& p) +</pre> +<blockquote> + <p><i>Effects: </i> + <code> std::basic_string<Char> str;<br> + is >> + <a href="../../../io/doc/quoted_manip.html">boost::io::quoted</a>(str, + static_cast<Char>('&'));<br> + p = str;</code></p> + <p><i>Returns:</i> + <code>is</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 system_error + { + public: + filesystem_error(); + filesystem_error(const filesystem_error&); + <a href="#filesystem_error-2-arg">filesystem_error</a>(const std::string& what_arg, + system::error_code ec); + <a href="#filesystem_error-3-arg">filesystem_error</a>(const std::string& what_arg, + const path& p1, system::error_code ec); + <a href="#filesystem_error-4-arg">filesystem_error</a>(const std::string& what_arg, + const path& p1, const path& p2, system::error_code ec); + + filesystem_error& filesystem_error(const filesystem_error&); + ~filesystem_error(); + + filesystem_error& operator=(const filesystem_error&); + + const path& <a href="#filesystem_error-path1">path1</a>() const; + const path& <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& what_arg, error_code ec);</pre> +<blockquote> + <p><i>Postcondition:</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> + runtime_error::what()</code></td> + <td width="82%" bgcolor="#FFFFFF"> + <code><i>what_arg</i>.c_str()</code></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& what_arg, const path_type& p1, error_code ec);</pre> +<blockquote> + <p><i>Postcondition:</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> + runtime_error::what()</code></td> + <td width="82%"> + <code><i>what_arg</i>.c_str()</code></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%">Reference to stored copy of + <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& what_arg, const path_type& p1, const path_type& p2, error_code ec);</pre> +<blockquote> + <p><i>Postcondition:</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> + runtime_error::what()</code></td> + <td width="82%"> + <u> + <code><i>w</i></code></u><code><i>hat_arg</i>.c_str()</code></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%">Reference to stored copy of + <code>p1</code></td> + </tr> + <tr> + <td width="18%"><code>path2()</code></td> + <td width="82%">Reference to stored copy of + <code>p2</code></td> + </tr> + </table> +</blockquote> +<pre>const path& <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& <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="Enum-file_type">Enum file_type</a></h3> +<p>This enum specifies constants uses to identify file types.</p> +<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111"> + <tr> + <td><b>Constant Name</b></td> + <td><b>Meaning</b></td> + </tr> + <tr> + <td><code>status_error</code></td> + <td>An error occurred while trying to obtain the status of the file. The + file simply not being found is <b><u>not</u></b> considered a status error. + </td> + </tr> + <tr> + <td><code>file_not_found</code></td> + <td>The file could not be found</td> + </tr> + <tr> + <td><code>regular_file</code></td> + <td>Regular file</td> + </tr> + <tr> + <td><code>directory_file</code></td> + <td>Directory file</td> + </tr> + <tr> + <td><code>symlink_file</code></td> + <td>Symbolic link file</td> + </tr> + <tr> + <td><code>block_file</code></td> + <td>Block special file</td> + </tr> + <tr> + <td><code>character_file</code></td> + <td>Character special file</td> + </tr> + <tr> + <td><code>fifo_file</code></td> + <td>FIFO or pipe file</td> + </tr> + <tr> + <td><code>socket_file</code></td> + <td>Socket file</td> + </tr> + <tr> + <td><code>type_unknown</code></td> + <td>The file exists, but it is of a system specific type not covered by any + of the above cases.</td> + </tr> +</table> +<h3><a name="Enum-perms">Enum perms</a></h3> +<p>This enum specifies bitmask constants uses to identify file +permissions. The POSIX standard specifies actual values, and those values have +been adopted here because they are very familiar and ingrained for many POSIX +users.</p> +<blockquote> +<p>Caution: Operating systems do not always support permissions as described in +the table.</p> +<p>There is much variation in the meaning of <code><a href="#sticky_bit"> +sticky_bit</a></code>; do not use it unless you understand what it means for +your operating system.</p> +<p>There is much variation in how operating systems treat symlinks. See <code> +<a href="#symlink_perms">symlink_perms</a></code>.</p> +<p>Windows: All permissions except write are currently ignored. There is only a +single write permission; setting write permission for owner, group, or others +sets write permission for all, and removing write permission for owner, group, +or others removes write permission for all. </p> +</blockquote> +<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111"> + <tr> + <td><b>Name</b></td> + <td align="center"><b>Value<br> + (octal)</b></td> + <td align="center"><b>POSIX<br> + macro</b></td> + <td><b>Definition or notes</b></td> + </tr> + +<tr><td> + <p dir="ltr"><code>no_perms</code></td><td><code>0</code></td><td></td> + <td>There are no permissions set for the file. Note: <code>file_not_found</code> is + <code>no_perms</code> rather than <code>perms_not_known</code></td> +</tr> +<tr><td><code>owner_read</code></td><td><code>0400</code></td><td> <code>S_IRUSR</code></td> + <td> Read permission, owner</td> +</tr> +<tr><td><code>owner_write</code></td><td><code>0200</code></td><td> <code>S_IWUSR</code></td> + <td> Write permission, owner</td> +</tr> +<tr><td><code>owner_exe</code></td><td><code>0100</code></td><td> <code>S_IXUSR</code></td> + <td> Execute/search permission, owner</td> +</tr> +<tr><td><code>owner_all</code></td><td><code>0700</code></td><td> <code>S_IRWXU</code></td> + <td> Read, write, execute/search by owner; <code>owner_read | owner_write | owner_exe</code></td> +</tr> +<tr><td><code>group_read</code></td><td><code>040</code></td><td> <code>S_IRGRP</code></td> + <td> Read permission, group</td> +</tr> +<tr><td><code>group_write</code></td><td><code>020</code></td><td> <code>S_IWGRP</code></td> + <td> Write permission, group</td> +</tr> +<tr><td><code>group_exe</code></td><td><code>010</code></td><td> <code>S_IXGRP</code></td> + <td> Execute/search permission, group</td> +</tr> +<tr><td><code>group_all</code></td><td><code>070</code></td><td> <code>S_IRWXG</code></td> + <td> Read, write, execute/search by group; <code>group_read | group_write | + group_exe</code></td> +</tr> +<tr><td><code>others_read</code></td><td><code>04</code></td><td> <code>S_IROTH</code></td> + <td> Read permission, others</td> +</tr> +<tr><td><code>others_write</code></td><td><code>02</code></td><td> <code>S_IWOTH</code></td> + <td> Write permission, others</td> +</tr> +<tr><td><code>others_exe</code></td><td><code>01</code></td><td> <code>S_IXOTH</code></td> + <td> Execute/search permission, others</td> +</tr> +<tr><td><code>others_all</code></td><td><code>07</code></td><td> <code>S_IRWXO</code></td> + <td>Read, write, execute/search by others; <code>others_read | others_write | others_exe</code></td> +</tr> +<tr><td><code>all_all</code></td><td><code>0777</code></td><td> </td><td><code>owner_all | group_all | others_all</code></td> +</tr> +<tr><td><code>set_uid_on_exe</code></td><td><code>04000</code></td><td> <code>S_ISUID</code></td> + <td> Set-user-ID on execution</td> +</tr> +<tr><td><code>set_gid_on_exe</code></td><td><code>02000</code></td><td> <code>S_ISGID</code></td> + <td> Set-group-ID on execution</td> +</tr> +<tr><td><code><a name="sticky_bit">sticky_bit</a> </code> </td><td><code>01000</code></td><td> <code>S_ISVTX</code></td> + <td> Meaning varies; see <a href="http://en.wikipedia.org/wiki/Sticky_bit">http:en.wikipedia.org/wiki/Sticky_bit</a></td> +</tr> +<tr><td><code>perms_mask</code></td><td><code>07777</code></td><td> </td> + <td><code>all_all | set_uid_on_exe | set_gid_on_exe | sticky_bit</code></td> +</tr> +<tr><td><code>perms_not_known</code></td><td><code>0xFFFF</code></td><td></td><td> + The permissions are not known, such as when a <code>file_status</code> object + is created without specifying the permissions</td> +</tr> +<tr><td> + <p dir="ltr"><code>add_perms</code></td><td><code>0x1000</code></td><td></td><td> + <p dir="ltr"><code>permissions()</code> adds the argument permission bits to the + file's current bits</td> +</tr> +<tr><td><code>remove_perms</code></td><td><code>0x2000</code></td><td></td><td> + <code>permissions()</code> removes the argument permission bits from the + file's current bits</td> +</tr> +<tr><td><code><a name="symlink_perms">symlink_perms</a></code></td><td><code>0x4000</code></td><td></td><td> + On POSIX <code>permissions()</code> resolves symlinks unless <code>symlink_perms</code> + is specified. + Meaningless on Windows as <code>permissions()</code> never resolves symlinks. + Meaningless on Mac OS X and some other BSD systems as <code>permissions()</code> + always resolves symlinks. Get over it.</td> +</tr> + +</table> +<h3><a name="file_status">Class file_status</a></h3> +<pre> namespace boost + { + namespace filesystem + { + class file_status + { + public: + + // <a href="#file_status-constructors">constructors</a> + file_status() noexcept; + explicit file_status(<a href="#file_type">file_type</a> ft, <a href="#Enum-perms">perms</a> prms = perms_not_known) noexcept; + + // compiler generated + file_status(const file_status&) noexcept; + file_status& operator=(const file_status&) noexcept; + ~file_status() noexcept; + + // <a href="#file_status-observers">observers</a> + <a href="#file_type">file_type</a> type() const noexcept; + <a href="#Enum-perms">perms</a> permissions() const noexcept; + + // <a href="#file_status-modifiers">modifiers</a> + void type(<a href="#file_type">file_type</a> ft) noexcept; + void permissions(<a href="#Enum-perms">perms</a> prms) noexcept; + }; + } // namespace filesystem + } // namespace boost</pre> +<p>An object of type <code>file_status</code> stores information about the type +and permissions of a file.</p> +<h4 dir="ltr"><a name="file_status-constructors"><code>file_status</code> +constructors</a></h4> +<pre>explicit file_status() noexcept;</pre> +<blockquote> + <p><i>Postconditions:</i> <code>type() == status_error</code>, <code> + permissions() == perms_not_known</code>.</p> +</blockquote> +<pre>explicit file_status(<a href="#file_type">file_type</a> ft, <a href="#Enum-perms">perms</a> prms = perms_not_known) noexcept;</pre> +<blockquote> + <p><i>Postconditions:</i> <code>type() == ft</code>, <code>permissions() == + prms</code>.</p> +</blockquote> + <h4 dir="ltr"><a name="file_status-observers"><code>file_status</code> + observers</a></h4> +<pre><a href="#file_type">file_type</a> type() const noexcept;</pre> +<blockquote> + <p><i>Returns: </i>The value of <code>type()</code> specified by the <i> + postconditions</i> of the most recent call to a constructor, operator=, or + <code>type(file_type)</code> function.</p> +</blockquote> +<pre><a href="#Enum-perms">perms</a> permissions() const noexcept;</pre> +<blockquote> + <p><i>Returns: </i>The value of <code>permissions()</code> specified by the <i> + postconditions</i> of the most recent call to a constructor, operator=, or + <code>permissions(perms)</code> function.</p> +</blockquote> +<h4 dir="ltr"><a name="file_status-modifiers"><code>file_status</code> modifiers</a></h4> +<pre>void type(<a href="#file_type">file_type</a> ft) noexcept;</pre> +<blockquote> + <p dir="ltr"><i>Postconditions:</i> <code>type() == ft</code>.</p> +</blockquote> +<pre>void permissions(<a href="#Enum-perms">perms</a> prms) noexcept;</pre> +<blockquote> + <p dir="ltr"><i>Postconditions:</i> <code>permissions() == prms</code>.</p> +</blockquote> +<h3><a name="Class-directory_entry">Class <code>directory_entry</code></a></h3> +<div dir="ltr"> +<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&); + explicit directory_entry(const path_type& p, file_status st=file_status(), + file_status symlink_st=file_status()); + ~directory_entry(); + + // <a href="#directory_entry-modifiers">modifiers</a> + directory_entry& operator=(const directory_entry&); + void assign(const path_type& p, file_status st=file_status(), + file_status symlink_st=file_status()); + void replace_filename(const path& p, file_status st=file_status(), + file_status symlink_st=file_status()); + + // <a href="#directory_entry-observers">observers</a> + const path& path() const; + file_status status() const; + file_status status(system::error_code& ec) const; + file_status symlink_status() const; + file_status symlink_status(system::error_code& ec) const; + + bool operator< (const directory_entry& rhs); + bool operator==(const directory_entry& rhs); + bool operator!=(const directory_entry& rhs); + bool operator< (const directory_entry& rhs); + bool operator<=(const directory_entry& rhs); + bool operator> (const directory_entry& rhs); + bool operator>=(const directory_entry& rhs); + private: + path_type m_path; // for exposition only + mutable file_status m_status; // for exposition only; stat()-like + mutable file_status m_symlink_status; // for exposition only; lstat()-like + }; + + } // namespace filesystem + } // namespace boost</pre> +</div> +<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>Postcondition:</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& p, file_status st=file_status(), file_status symlink_st=file_status());</pre> +<blockquote> + <p><i>Postcondition:</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& p, file_status st=file_status(), file_status symlink_st=file_status());</pre> +<blockquote> + <p><i>Postcondition:</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& p, file_status st=file_status(), file_status symlink_st=file_status());</pre> +<blockquote> + <p><i>Postcondition:</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& path() const;</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path</code></p> +</blockquote> +<pre>file_status status() const; +file_status status(system::error_code& ec) const;</pre> +<blockquote> +<p><i>Effects:</i> +As if,</p> + <blockquote> + <pre>if ( !status_known( m_status ) ) +{ + if ( status_known(m_symlink_status) && !is_symlink(m_symlink_status) ) + { m_status = m_symlink_status; } + else { m_status = status(m_path<i>[, ec]</i>); } +}</pre> + </blockquote> + <p><i>Returns:</i> <code>m_status</code></p> + + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + +</blockquote> +<pre>file_status symlink_status() const; +file_status symlink_status(system::error_code& ec) const;</pre> +<blockquote> +<p> + <i>Effects:</i> +As if,</p> + <blockquote> + <pre>if ( !status_known( m_symlink_status ) ) +{ + m_symlink_status = symlink_status(m_path<i>[, ec]</i>); +}</pre> + </blockquote> + <p><i>Returns:</i> <code> + m_symlink_status</code></p> + + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + +</blockquote> +<pre>bool operator==(const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path == + rhs.m_path</code>.</p> +</blockquote> +<pre>bool operator!=(const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path != + rhs.m_path</code>.</p> +</blockquote> +<pre>bool operator< (const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path < + rhs.m_path</code>.</p> +</blockquote> +<pre>bool operator<=(const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path <= + rhs.m_path</code>.</p> +</blockquote> +<pre>bool operator> (const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path > + rhs.m_path</code>.</p> +</blockquote> +<pre>bool operator>=(const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path >= + rhs.m_path</code>.</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< directory_iterator, + <a href="#Class-directory_entry">directory_entry</a>, + boost::single_pass_traversal_tag > + { + public: + // <a href="#directory_iterator-members">member functions</a> + + directory_iterator(); // creates the "end" iterator + directory_iterator(const directory_iterator&); + explicit directory_iterator(const path& p); + directory_iterator(const path& p, system::error_code& ec); + ~directory_iterator(); + + directory_iterator& operator=(const directory_iterator&); + + directory_iterator& operator++(); + directory_iterator& increment(system::error_code& 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&</code> is returned. The result of +<code>operator-></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& p<code>); +directory_iterator(</code>const path& p, system::error_code& 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(".")</code> rather than <code>directory_iterator("")</code>. +<i>-- end note</i>]</p> +</blockquote> +<pre>directory_iterator& <a name="directory_iterator-increment">operator++</a>(); +directory_iterator& increment(system::error_code& 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>recursive_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<input_iterator_tag, directory_entry> + { + public: + + // constructors and destructor + recursive_directory_iterator(); + recursive_directory_iterator(const recursive_directory_iterator&); + explicit recursive_directory_iterator(const path& p, + BOOST_SCOPED_ENUM(<a href="#symlink_option">symlink_option</a>) opt = symlink_option::none); + recursive_directory_iterator(const path& p, + BOOST_SCOPED_ENUM(<a href="#symlink_option">symlink_option</a>) opt, system::error_code& ec); + recursive_directory_iterator(const path& p, system::error_code& ec); + ~recursive_directory_iterator(); + + // observers + int level() const; + bool no_push<code>_pending</code>() const; + + // modifiers + recursive_directory_iterator& operator=(const recursive_directory_iterator&); + + recursive_directory_iterator& operator++(); + recursive_directory_iterator& increment(system::error_code& ec); + + void pop(); + void no_push(bool value=true); + + // other members as required by + // C++ Std, 24.1.2 Input iterators [input.iterators] + + private: +<i><b> // actual data members will probably be stored in a shared pimpl object, + // or some similar mechanism, to achieve the required input iterator copy semantics +</b></i> int m_level; <b><i> // for exposition only</i></b> + bool m_no_<code>push</code>; <i><b> // for exposition only + </b></i>BOOST_SCOPED_ENUM(<a href="#symlink_option">symlink_option</a>) m_options; <i><b>// for exposition only</b></i> + }; + + } // 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>Incrementing a <code>recursive_directory_iterator</code> pointing to a + directory causes that directory itself to be iterated ovee, as specified by + the <code>operator++</code> and <code>increment</code> functions.<br> + </li> + <li>When a <code>recursive_directory_iterator</code> 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 of the parent directory continues.</li> +</ul> +<pre>recursive_directory_iterator();</pre> +<blockquote> + +<p><i>Effects:</i> Constructs the end iterator.</p> + +<p><i>Throws:</i> Nothing.</p> + +</blockquote> + +<pre>explicit recursive_directory_iterator(const path& p, BOOST_SCOPED_ENUM(<a href="#symlink_option">symlink_option</a>) opt = symlink_option::none); +recursive_directory_iterator(const path& p, BOOST_SCOPED_ENUM(<a href="#symlink_option">symlink_option</a>) opt, system::error_code& ec); +recursive_<code>directory_iterator(</code>const path& p, system::error_code& 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 dir="ltr"><i>Postcondition: </i>Unless the end iterator was constructed,<i> </i> +<code>level() == 0 && no_push_pending() == false && m_options == opt</code>. +For the signature without a <code>symlink_option</code> argument, <code>opt</code> +is assumed to be <code>symlink_option::none</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(".")</code> rather than +<code>recursive_directory_iterator("")</code>. +<i>-- end note</i>]</p> + +<p>[<i>Note:</i> By default, <code>recursive_directory_iterator</code> does not +follow directory symlinks. To follow directory symlinks, specify <code>opt</code> +as <code>symlink_option::recurse</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_pending</code>() const;</pre> +<blockquote> + <p><i>Requires:</i> <code>*this != recursive_directory_iterator()</code>.</p> + <p><i>Returns:</i> <code>m_no_push</code>.</p> + <p><i>Throws:</i> Nothing.</p> +</blockquote> +<pre><code>recursive_directory_iterator</code>& <a name="recursive_directory_iterator-increment">operator++</a>(); +recursive_directory_iterator& increment(system::error_code& ec);</pre> +<blockquote> + +<p><i>Effects:</i> As specified by the C++ Standard, 24.1.1 Input iterators [input.iterators], +except:</p> + +<ul> + <li dir="ltr"> + +<p dir="ltr">if <code>!no_push_pending() && is_directory(this->status()) +&& (!is_symlink(this->symlink_status()) || (m_options +& symlink_option::recurse) != 0)</code> then <code>m_level</code> +is incremented and directory <code>(*this)->path()</code> is recursively iterated into.<br> + </p> + + </li> + <li>if there are no more directory entries at this level then <code>m_level</code> +is decremented and iteration of the parent directory resumes.</li> +</ul> + +<p><i>Postcondition:</i> <code>no_push_pending() == 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(bool value=true);</pre> +<blockquote> + <p><i>Requires:</i> <code>*this != recursive_directory_iterator()</code>.</p> +<p><i>Postcondition:</i> <code>no_push_pending() == value</code>.</p> + <p><i>Throws:</i> Nothing.</p> + <p>[<i>Note:</i> <code>no_push()</code> is used to prevent + unwanted recursion into a directory. <i>--end note</i>]</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. 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& p, const path& base=current_path());</pre> + <blockquote> + <p><i>Returns:</i> A <a href="#Absolute-path">absolute path</a> composed according to the + following table</p> + <table border="1" cellpadding="5" cellspacing="0" bordercolor="#111111" style="border-collapse: collapse"> + <tr> + <td align="center"> </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 dir="ltr">[<i>Note:</i> For the returned path, <code>rp,</code> <code> + rp.is_absolute()</code> is true. <i>-- end note</i>]</p> + <p><i>Throws:</i> If <code>base.is_absolute()</code> is true, throws only if + memory allocation fails.</p> +</blockquote> +<pre>path <a name="canonical">canonical</a>(const path& p, const path& base = current_path()); +path canonical(const path& p, system::error_code& ec); +path canonical(const path& p, const path& base, system::error_code& ec);</pre> +<blockquote> +<p><i>Overview:</i> Converts <code>p</code>, which must exist, to an absolute +path that has no symbolic link, <a href="#Dot">dot</a>, +or <a href="#Dot">dot-dot</a> elements. </p> +<p><i>Returns:</i> A <a href="#Canonical-path">canonical path</a> that refers to +the same file system object as <code>absolute(p,base)</code>. For the overload +without a <code>base</code> argument, <code>base</code> is <code>current_path()</code>.</p> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + + <p><i>Remarks:</i> <code>!exists(p)</code> is an error.</p> + + <p>[<i>Note:</i> Canonical pathnames allow security checking of a path (eg. + does this path live in /home/goodguy or /home/badguy?) -- end note]</p> + +</blockquote> +<pre>void <a name="copy">copy</a>(const path& from, const path& to); +void copy(const path& from, const path& to, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> As if</p> + + <blockquote> + <pre>file_status s(symlink_status(from<i>[</i><code>, ec</code><i>]</i>)); +if(is_symlink(s)) + copy_symlink(from, to<i>[</i><code>, ec</code><i>]</i>); +else if(is_directory(s)) + copy_directory(from, to<i>[</i><code>, ec</code><i>]</i>); +else if(is_regular_file(s)) + copy_file(from, to, copy_option::fail_if_exists<i>[</i><code>, ec</code><i>]</i>); +else +<i> Report error as specified in <a href="#Error-reporting">Error reporting</a>.</i></pre> + </blockquote> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + +</blockquote> +<pre>void <a name="copy_directory">copy_directory</a>(const path& from, const path& to); +void copy_directory(const path& from, const path& to, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects: </i></p> + + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + +</blockquote> +<pre>void copy_file(const path& from, const path& to); +void copy_file(const path& from, const path& to, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects: </i><code>copy_file(from, to, + copy_option::fail_if_exists</code><i>[</i><code>, ec</code><i>]</i><code>)</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& from, const path& to, BOOST_SCOPED_ENUM(<a href="#copy_option">copy_option</a>) option); +void <a name="copy_file2">copy_file</a>(const path& from, const path& to, BOOST_SCOPED_ENUM(<a href="#copy_option">copy_option</a>) option, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> If <code>option == copy_option::</code><code>fail_if_exists + && exists(to)</code>, an error is reported. Otherwise, the 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>void <a name="copy_symlink">copy_symlink</a>(const path& existing_symlink, const path& new_symlink); +void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects: </i><code>create_symlink(read_symlink(existing_symlink</code><i>[</i><code>, ec</code><i>]</i><code>), + new_symlink</code><i>[</i><code>, ec</code><i>]</i><code>)</code>.</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& p); +bool <a name="create_directories2">create_directories</a>(const path& p, system::error_code& 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>Postcondition:</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& p); +bool <a name="create_directory2">create_directory</a>(const path& p, system::error_code& 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>void <a name="create_directory_symlink">create_directory_symlink</a>(const path& to, const path& new_symlink); +void create_directory_symlink(const path& to, const path& new_symlink, system::error_code& ec);</pre> +<blockquote style="font-size: 10pt"> + <p style="font-size: 10pt"><i>Effects:</i> + Establishes the postcondition, as if by <i> + POSIX</i> + <code> + <a href="http://www.opengroup.org/onlinepubs/000095399/functions/symlink.html"> + symlink()</a></code>.</p> + <p style="font-size: 10pt"><i> + Postcondition:</i> <code>new_symlink</code> resolves to a symbolic link file that + contains an unspecified representation of <code>to</code>.</p> + <p style="font-size: 10pt"><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + <p style="font-size: 10pt">[<i>Note:</i> + Some <b>operating systems</b>, such as Windows, require symlink creation to + identify that the link is to a directory. Portable code should use <code> + create_directory_symlink()</code> to create directory symlinks rather than + <code>create_symlink()</code> <i>-- end note</i>]</p> + <p>[<i>Note:</i> + 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. <i>-- end note</i>]</p> + </blockquote> +<pre>void <a name="create_hard_link">create_hard_link</a>(const path& to, const path& new_hard_link); +void <a name="create_hard_link2">create_hard_link</a>(const path& to, const path& new_hard_link, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> Establishes the postcondition, as if by + <i>POSIX</i> + <code> + <a href="http://www.opengroup.org/onlinepubs/000095399/functions/link.html"> + link()</a></code>.</p> + <p><i>Postcondition:</i></p> + <ul> + <li> <code>exists(to) && + exists(</code><code>new_hard_link</code><code>) && equivalent(to, + + </code><code>new_hard_link</code><code>)</code></li> + <li>The contents of the file or directory + <code>to</code> resolves to are unchanged.</li> + </ul> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + <p>[<i>Note:</i> + 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. <i>-- end note</i>]</p> + </blockquote> +<pre>void <a name="create_symlink">create_symlink</a>(const path& to, const path& new_symlink); +void <a name="create_symlink2">create_symlink</a>(const path& to, const path& new_symlink, system::error_code& ec);</pre> +<blockquote style="font-size: 10pt"> + <p style="font-size: 10pt"><i>Effects:</i> + Establishes the postcondition, as if by <i> + POSIX</i> + <code> + <a href="http://www.opengroup.org/onlinepubs/000095399/functions/symlink.html"> + symlink()</a></code>.</p> + <p style="font-size: 10pt"><i> + Postcondition:</i> <code>new_symlink</code> resolves to a symbolic link file that + contains an unspecified representation of <code>to</code>.</p> + <p style="font-size: 10pt"><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + <p>[<i>Note:</i> + 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. <i>-- end note</i>]</p> + </blockquote> +<pre>path <a name="current_path">current_path</a>(); +path <a name="current_path2">current_path</a>(system::error_code& 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. <i>-- end note</i>]</p> +</blockquote> +<pre>void current_path(const path& p); +void current_path(const path& p, system::error_code& ec);</pre> +<blockquote> + <p style="font-size: 10pt"><i>Effects:</i> + Establishes the postcondition, as if by <i> + POSIX</i> + <code> + <a href="http://www.opengroup.org/onlinepubs/000095399/functions/chdir.html"> + chdir()</a></code>.</p> +<p><i>Postcondition:</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. <i>-- end note</i>]</p> +</blockquote> +<pre>bool <a name="exists">exists</a>(file_status s);</pre> +<blockquote> + <p><i>Returns:</i> + <code>status_known(s) && s.type() != file_not_found</code></p> + <p><i>Throws:</i> Nothing.</p> +</blockquote> +<pre>bool <a name="exists2">exists</a>(const path& p); +bool <a name="exists3">exists</a>(const path& p, system::error_code& 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&</code> throws +nothing.</p> +</blockquote> +<pre><code>bool <a name="equivalent">equivalent</a>(const path& p1, const path& p2); +bool <a name="equivalent2">equivalent</a>(const path& p1, const path& p2, system::error_code& 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 <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>"st_dev</i> + must be unique within a Local Area Network". 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 "same" 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> + if <code>(!exists(s1) && !exists(s2)) || (is_other(s1) && is_other(s2))</code>, + otherwise as specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> +</blockquote> +<div dir="ltr"> +<pre>uintmax_t <a name="file_size">file_size</a>(const path& p); +uintmax_t <a name="file_size2">file_size</a>(const path& p, system::error_code& ec);</pre> +</div> +<blockquote> + <p> + <span style="background-color: #FFFF00">Remarks: </span> + </p> + <p><i>Returns:</i> If <code>exists(p) && is_regular_file(p)</code>, the size + in bytes + 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<uintmax_t>(-1)</code>.</p> + <p style="font-size: 10pt"><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> +</blockquote> +<pre>uintmax_t <a name="hard_link_count">hard_link_count</a>(const path& p); +uintmax_t hard_link_count(const path& p, system::error_code& ec);</pre> +<blockquote> + + <p><i>Returns:</i> The number of hard links for <code>p</code>.</p> + <p style="font-size: 10pt"><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + +</blockquote> + +<pre>const path& <a name="initial_path">initial_path</a>(); +const path& <a name="initial_path">initial_path</a>(<code>system::error_code& ec</code>);</pre> +<blockquote> + <p><i>Returns:</i> + <code>current_path()</code> as of the first call to <code>initial_path()</code>.</p> + <p>[<i>Note:</i> <code> + initial_path()</code> is not thread safe, and may return an undesirable result + if called subsequent to a change to the current directory. These problems can + be avoided by calling <code>initial_path()</code> immediately on entry to + main(). <i>--end note</i>]</p> + <p><i>Throws:</i> For the first call, as specified in + <a href="#Error-reporting"> + Error reporting</a>. Subsequent calls throw nothing.</p> +</blockquote> +<pre>bool <code><a name="is_directory">is_directory</a></code>(file_status s);</pre> +<blockquote> + <p><i>Returns:</i> + <code>s.type() == directory_file</code></p> + <p><i>Throws:</i> Nothing.</p> +</blockquote> +<pre><code>bool <a name="is_directory2">is_directory</a>(const path& p); +bool <a name="is_directory3">is_directory</a>(const path& p, system::error_code& 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&</code> throws +nothing.</p> +</blockquote> +<pre><code>bool <a name="is_empty">is_empty</a>(const path& p); +bool <a name="is_empty2">is_empty</a></a>(const path& p, system::error_code& 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> + ? + directory_iterator(p) == directory_iterator()<br> + : 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& 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& p, system::error_code& 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>bool <a name="is_other">is_other</a>(file_status s);</pre> +<blockquote> + <p><i>Returns:</i> + <code>return exists(s) && !is_regular_file(s) && !is_directory(s) && !is_symlink(s)</code></p> + <p><i>Throws:</i> Nothing.</p> +</blockquote> +<pre><code>bool <a name="is_other2">is_other</a>(const path& p); +bool <a name="is_other3">is_other</a>(const path& p, system::error_code& 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&</code> throws + nothing.</p> +</blockquote> +<pre>bool <a name="is_symlink">is_symlink</a>(file_status s);</pre> +<blockquote> + <p><i>Returns:</i> + <code>s.type() == symlink_file</code></p> + <p><i>Throws:</i> Nothing.</p> +</blockquote> +<pre><code>bool <a name="is_symlink2">is_symlink</a>(const path& p); +bool <a name="is_symlink3">is_symlink</a>(const path& p, system::error_code& 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&</code> throws + nothing.</p> +</blockquote> +<pre>std::time_t <a name="last_write_time">last_write_time</a>(const path& p); +std::time_t <a name="last_write_time2">last_write_time</a>(const path& p<code>, system::error_code& 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> 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& p, const std::time_t new_time); +void <a name="last_write_time4">last_write_time</a>(const path& p, const std::time_t new_time<code>, system::error_code& 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>void permissions(const path& p, <a href="#symlink_perms">perms</a> prms); +void permissions(const path& p, <a href="#symlink_perms">perms</a> prms, system::error_code& ec);</pre> +<blockquote> + <p dir="ltr">Applies an operating system set of permissions to a file. See + <a href="#symlink_perms">perms</a> for specifics.<br> + <i><br> + Requires:</i> <code>!((prms & add_perms) && (prms & remove_perms))</code>.</p> + <p dir="ltr"><i>Effects:</i> Applies the effective permissions bits from <code> + prms</code> to the file <code>p</code> resolves to, as if by <i>POSIX</i> + <code> + <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchmodat.html"> + fchmodat()</a></code>. The effective permission bits are determined as + specified by the following table. </p> + <table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111"> + <tr> + <td><b>bits present in <code>prms</code></b></td> + <td><b>Effective bits applied</b></td> + </tr> + <tr> + <td>Neither <code>add_perms</code> nor <code>remove_perms</code></td> + <td><code>prms & perms_mask</code></td> + </tr> + <tr> + <td><code>add_perms</code></td> + <td> + <p dir="ltr">current_status.permissions() | (<code>prms & perms_mask</code>) + </td> + </tr> + <tr> + <td><code>remove_perms</code></td> + <td>current_status.permissions() & ~(<code>prms & perms_mask</code>) </td> + </tr> + </table> + <p>[<i>Note:</i> Conceptually permissions are viewed as bits, but the actual + implementation by a file system may use some other mechanism. -- <i>end note</i>]</p> +</blockquote> +<pre>path <a name="read_symlink">read_symlink</a>(const path& p); +path read_symlink(const path& p, system::error_code& ec);</pre> +<blockquote> + <p dir="ltr"><i>Returns:</i> 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& p); +bool <a name="remove2">remove</a>(const path& p, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> 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> <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& p); +uintmax_t <a name="remove_all2">remove_all</a>(const path& p, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> 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& old_p, const path& new_p); +void <a name="rename2">rename</a>(const path& old_p, const path& new_p, system::error_code& 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& p, uintmax_t new_size); +void <a name="resize_file2">resize_file</a>(const path& p, uintmax_t new_size, system::error_code& ec);</pre> +<blockquote> +<p><i>Postcondition:</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>space_info <a name="space">space</a>(const path& p); +space_info <a name="space2">space</a>(const path& p, system::error_code& ec);</pre> +<blockquote> + <p><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 <i>POSIX</i> <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.</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& 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& p, system::error_code& 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>. <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> + </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> + </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. <i>--end note</i>]</p> + </blockquote> + <p>Otherwise,</p> + <ul> + <li>If the attributes indicate a regular file, as if by <i>POSIX</i> <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><fstream></code> operations + would succeed, assuming no hardware, permission, access, or race condition + errors. Lack of +<code>regular_file</code> does not necessarily imply <code><fstream></code> operations would +fail on a directory. +<i>-- end note</i>]<br> + </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> + </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> + </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> + </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> + </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> + </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>bool <a name="status_known">status_known</a>(file_status s);</pre> +<blockquote> + <p><i>Returns:</i> + <code>s.type() != status_error</code></p> + <p><i>Throws:</i> Nothing.</p> +</blockquote> +<pre>file_status <a name="symlink_status">symlink_status</a>(const path& p); +file_status <a name="symlink_status2">symlink_status</a>(const path& p, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> 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& p); +path <a name="system_complete2">system_complete</a>(const path& p, system::error_code& 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>Postcondition:</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="temp_directory_path">temp_directory_path</a>(); +path temp_directory_path(system::error_code& ec);</pre> +<blockquote> + <p><i>Returns:</i> A directory path suitable for temporary files under the + conventions of the operating system. The specifics of how this path is + determined are implementation defined. An error shall be reported if<code> !exists(p) + || !is_directory(p)</code>, where <code>p</code> is the path to be returned.</p> + <p><i>POSIX:</i> The path supplied by the first environment variable found in the + list TMPDIR, TMP, TEMP, TEMPDIR. If none of these are found, <code>"/tmp"</code>.</p> + <p><i>Windows:</i> The path reported by the <i>Windows</i> <code>GetTempPath</code> API function.</p> + <p><i>Throws:</i> As specified in <a href="#Error-reporting"> + Error reporting</a>.</p> + <p>[<i>Note: </i>The <code>temp_directory_path()</code> name was chosen to emphasize that the return is a + path, not just a single directory name. <i>-- end note</i>]</p> +</blockquote> +<pre>path <a name="unique_path">unique_path</a>(const path& model="%%%%-%%%%-%%%%-%%%%"); +path unique_path(const path& model, system::error_code& 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"><boost/filesystem/fstream.hpp></a></h3> +<p>Replacements are provided for the file stream classes from the C++ standard +library's <code><fstream></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&</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 < class charT, class traits = std::char_traits<charT> > + class basic_filebuf : public std::basic_filebuf<charT,traits> + { + public: + basic_filebuf<charT,traits>* + open(const path& p, std::ios_base::openmode mode); + }; + + template < class charT, class traits = std::char_traits<charT> > + class basic_ifstream : public std::basic_ifstream<charT,traits> + { + public: + explicit basic_ifstream(const path& p, std::ios_base::openmode mode=std::ios_base::in) + void open(const path& p, std::ios_base::openmode mode=std::ios_base::in); + }; + + template < class charT, class traits = std::char_traits<charT> > + class basic_ofstream : public std::basic_ofstream<charT,traits> + { + public: + explicit basic_ofstream(const path& p, std::ios_base::openmode mode=std::ios_base::out); + void open(const path& p, std::ios_base::openmode mode=std::ios_base::out); + }; + + template < class charT, class traits = std::char_traits<charT> > + class basic_fstream : public std::basic_fstream<charT,traits> + { + public: + explicit basic_fstream(const path& p, + std::ios_base::openmode mode=std::ios_base::in | std::ios_base::out); + void open(const path& p, + std::ios_base::openmode mode=std::ios_base::in | std::ios_base::out); + }; + + typedef basic_filebuf<char> filebuf; + typedef basic_ifstream<char> ifstream; + typedef basic_ofstream<char> ofstream; + typedef basic_fstream<char> fstream; + + typedef basic_filebuf<wchar_t> wfilebuf; + typedef basic_ifstream<wchar_t> wifstream; + typedef basic_fstream<wchar_t> wfstream; + typedef basic_ofstream<wchar_t> 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> +<table border="1" cellspacing="0" cellpadding="5"> +<p> +<tr><td><b>Constructor<br>argument</b></td> +<td><b>Iteration<br>over<br>Elements</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> +<h2><a name="long-path-warning"></a>Warning: Long paths on Windows and the +extended-length <b>\\?\ </b>prefix</h2> +<p>The Microsoft Windows "Maximum Path Length Limitation" specifies:</p> +<blockquote> +<p>In the Windows API (with some exceptions ...), the maximum length for a path +is MAX_PATH, which is defined as 260 characters.</p> +<p>The Windows API has many functions that also have Unicode versions to permit +an extended-length path for a maximum total path length of 32,767 characters. +... To specify an extended-length path, use the <b>"\\?\" prefix</b>. For +example, "\\?\D:\<em>very long path</em>". +<i>[C++ string literals require backslashes be doubled, of course.]</i></p> +</blockquote> +<p>Because most Boost.Filesystem operational functions just pass the contents of +a class path object to the Windows API, they do work with the extended-length +prefixes. But some won't work, because to the limitations imposed by Windows. +Read the following cautions carefully!</p> +<h3>Cautions for paths with extended-length prefixes</h3> +<ul> + <li>Individual components of a path are still are limited to whatever is + supported for the particular filesystem, commonly 255 characters.</li> + <li>Only backslashes only are acceptable as directory separators. Slashes are + not treated as separators.</li> + <li>All paths must be absolute - relative paths are not allowed.</li> + <li>Once an absolute path grows beyond 260 characters, it is essentially + poisoned and all operations must use extended-length prefixes. So even a + simple operation like <code>create_directory("a")</code> will fail if the + absolute path of the resulting directory would exceed 260 characters.</li> + <li>Certain Boost.Filesystem functions that decompose their argument path and + then work on individual relative directories or files will not work properly + with extended-length prefix paths.</li> +</ul> +<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. The temp_directory_path function was +contributed by Jeff Flinn. David Svoboda suggested the canonical function and +provided psuedo-code.</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> +<p> </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 Std 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><font size="2">© Copyright Beman Dawes, 2002, 2006, 2007, 2009, 2010, 2011</font></p> +<p><font size="2">Distributed under the Boost Software License, Version 1.0. See +</font> +<a href="http://www.boost.org/LICENSE_1_0.txt"><font size="2">www.boost.org/LICENSE_1_0.txt</font></a></p> +<p><font size="2">Revised +<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->31 October 2011<!--webbot bot="Timestamp" endspan i-checksum="32182" --></font></p> + +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/release_history.html b/libs/filesystem/v3/doc/release_history.html new file mode 100644 index 0000000000..daff2203b8 --- /dev/null +++ b/libs/filesystem/v3/doc/release_history.html @@ -0,0 +1,125 @@ +<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 Release History</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 Release History</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> + <a href="index.htm">Library Home</a> <a href="reference.html">Reference</a> + <a href="tutorial.html">Tutorial</a> + <a href="faq.htm">FAQ</a> + <a href="portability_guide.htm">Portability</a> + <a href="v3.html">V3 Intro</a> + <a href="v3_design.html">V3 Design</a> + <a href="deprecated.html">Deprecated</a> + </td> + </tr> +</table> + +<h2>1.49.0</h2> +<ul> + <li>Fix <a href="https://svn.boost.org/trac/boost/ticket/3714">#3714</a>, + Added test cases and fixes for class path errors when assignment or append + used self or portion of self as source. </li> + <li>Fix <a href="https://svn.boost.org/trac/boost/ticket/4889">#4889</a>, + <a href="https://svn.boost.org/trac/boost/ticket/6320">#6320</a>, Locale codecvt_facet not thread safe on Windows. Move + Windows, Mac OS X, locale and codecvt facet back to namespace scope. POSIX + except OS X uses local static initialization (IE lazy) to ensure exceptions + are catchable if environmental variables are misconfigured and to avoid use of + locale("") if not actually used.</li> + <li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5652">#5652</a>, + recursive_directory_iterator fails on cyclic symbolic links. Thanks to Daniel + Aarno for the patch.</li> + <li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5653">#5653</a>, + recursive_directory_iterator(error_code) can still throw filesystem_error.</li> + <li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5900">#5900</a>, directory_iterator + access violation on Windows if error is thrown. Thanks to Andreas Eckleder for the patch.</li> + <li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5900#comment:2">#5900 + comment 2</a>, a bug in director_iterator construction with error_code argument that + caused increment to be called without the ec argument being passed.</li> + <li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5900">#5989</a> by cleaning up test suite path_test.cpp code even + though the ticket itself was not a defect, and clarifying docs; iteration over a path yields + generic format.</li> + <li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5592">#5592</a>, Change Windows codecvt processing from CP_THREAD_ACP to CP_ACP.</li> + <li>Operations function fixes for PGI compiler, thanks to Noel Belcourt.</li> + <li>Relax permissions test to reflect reality, particularly on the Sandia test + platforms.</li> +</ul> + +<h2>1.48.0</h2> +<ul> + <li>Added operational function <a href="reference.html#canonical">canonical()</a>, + suggested by David Svoboda, who also provided pseudo-code.</li> + <li>Added <a href="reference.html#hash_value">hash_value()</a> function for + paths. (Daniel James)</li> + <li>Fix path inserter problem (<a href="https://svn.boost.org/trac/boost/ticket/5764">#5764</a>) + reported for QNX6.3.2 host (gcc-3.3.5)</li> + <li>Fix problem of locale("") exception being thrown before main() starts on + poorly configured (e.g. LANG="bad name") POSIX systems. Resolves the most + serious aspect of tickets + <a href="https://svn.boost.org/trac/boost/ticket/4688">#4688</a>, + <a href="https://svn.boost.org/trac/boost/ticket/5100">#5100</a>, + <a href="https://svn.boost.org/trac/boost/ticket/5289">#5289</a>.</li> +</ul> + +<h2>1.47.0</h2> +<ul> + <li>Program file_status.cpp added (V3). See boost-root/libs/filesystem/v3/example. + Useful both as an example and to explore how Boost.Filesystem treats various + status errors. Run "bjam" (NOT "bjam install") in the example directory + to install in example/bin.</li> +</ul> + +<h2>1.46.1</h2> + +<ul> + <li>Fix fstream problem for STLPort masquerading as Dinkumware (<a href="https://svn.boost.org/trac/boost/ticket/5217">#5217</a>).</li> +</ul> + +<h2>1.46.0</h2> +<ul> + <li>Version 3 of the library is now the default.</li> + <li>IBM vacpp: Workaround for compiler bug affecting iterator_facade. (<a href="https://svn.boost.org/trac/boost/ticket/4912">#4912</a>)</li> + <li>Verify, clarify, document that <boost/config/user.hpp> can be used to + specify BOOST_FILESYSTEM_VERSION. (<a href="https://svn.boost.org/trac/boost/ticket/4891">#4891</a>)</li> + <li>Replaced C-style assert with BOOST_ASSERT.</li> + <li>Undeprecated unique_path(). Instead, add a note mentioning the workaround + for lack of thread safety and possible change to cwd. unique_path() is just + too convenient to deprecate!</li> + <li>Cleared several GCC warnings.</li> + <li>Changed V2 code to use BOOST_THROW_EXCEPTION.</li> + <li>Windows: Fix status() to report non-symlink reparse point correctly.</li> + <li>Add <code>symlink_option</code> to <code>recursive_directory_iterator</code>, + allowing control over recursion into directory symlinks. Note that the default + is changed to not recurse into directory symlinks.</li> + <li><a href="reference.html">Reference</a> documentation cleanup, including + fixing missing and broken links, and adding missing functions.</li> + <li>Miscellaneous implementation code cleanup. </li> +</ul> +<hr> +<p>Revised +<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->24 January, 2012<!--webbot bot="Timestamp" endspan i-checksum="38510" --></p> +<p>© Copyright Beman Dawes, 2011</p> +<p> Use, modification, and distribution are subject to 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>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/src/README b/libs/filesystem/v3/doc/src/README new file mode 100644 index 0000000000..7b2433e0e9 --- /dev/null +++ b/libs/filesystem/v3/doc/src/README @@ -0,0 +1,14 @@ +This directory contains the source files used to generate the Filesystem library +reference documentation and the TR2 filesystem proposal. The generated HTML files +contain much common material that would be difficult to keep in sync if maintained +as separate files. + +Generation is performed by the Minimal Macro Processor, available from +https://github.com/Beman/mmp + +------------ + +Copyright Beman Dawes 2012 + +Distributed under the Boost Software Licence Version 1.0. +See http://www.boost.org/LICENSE_1_0.txt diff --git a/libs/filesystem/v3/doc/src/boost_snippets.html b/libs/filesystem/v3/doc/src/boost_snippets.html new file mode 100644 index 0000000000..16851aaee3 --- /dev/null +++ b/libs/filesystem/v3/doc/src/boost_snippets.html @@ -0,0 +1,124 @@ +<html> + +<head> +<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>New Page 1</title> +</head> + +<body> +$id frontmatter= + +<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">Filesystem Home</a> + <a href="release_history.html">Releases</a> + <a href="reference.html">Reference</a> + <a href="tutorial.html">Tutorial</a> + <a href="faq.htm">FAQ</a> + <a href="portability_guide.htm">Portability</a> + <a href="v3.html">V3 Intro</a> + <a href="v3_design.html">V3 Design</a> + <a href="deprecated.html">Deprecated</a> + </td> + </td> + </tr> +</table> + +<h1>Reference Documentation</h1> + +$endid + +$id wording_prefix= +<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> +$endid + +$id wording_suffix= +<h3><a name="File-streams">File streams</a> - +<a href="../../../../boost/filesystem/fstream.hpp"><boost/filesystem/fstream.hpp></a></h3> +<p>Replacements are provided for the file stream classes from the C++ standard +library's <code><fstream></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&</code> arguments +instead of <code> +const char*</code> arguments. There are no other differences in syntax or +semantics.</p> +<pre>$NAMESPACE_BEGIN; + template < class charT, class traits = std::char_traits<charT> > + class basic_filebuf : public std::basic_filebuf<charT,traits> + { + public: + basic_filebuf<charT,traits>* + open(const path& p, std::ios_base::openmode mode); + }; + + template < class charT, class traits = std::char_traits<charT> > + class basic_ifstream : public std::basic_ifstream<charT,traits> + { + public: + explicit basic_ifstream(const path& p, std::ios_base::openmode mode=std::ios_base::in) + void open(const path& p, std::ios_base::openmode mode=std::ios_base::in); + }; + + template < class charT, class traits = std::char_traits<charT> > + class basic_ofstream : public std::basic_ofstream<charT,traits> + { + public: + explicit basic_ofstream(const path& p, std::ios_base::openmode mode=std::ios_base::out); + void open(const path& p, std::ios_base::openmode mode=std::ios_base::out); + }; + + template < class charT, class traits = std::char_traits<charT> > + class basic_fstream : public std::basic_fstream<charT,traits> + { + public: + explicit basic_fstream(const path& p, + std::ios_base::openmode mode=std::ios_base::in | std::ios_base::out); + void open(const path& p, + std::ios_base::openmode mode=std::ios_base::in | std::ios_base::out); + }; + + typedef basic_filebuf<char> filebuf; + typedef basic_ifstream<char> ifstream; + typedef basic_ofstream<char> ofstream; + typedef basic_fstream<char> fstream; + + typedef basic_filebuf<wchar_t> wfilebuf; + typedef basic_ifstream<wchar_t> wifstream; + typedef basic_fstream<wchar_t> wfstream; + typedef basic_ofstream<wchar_t> wofstream; + +$NAMESPACE_END;</pre> + +$endid + +$id backmatter=> +<p><font size="2">© Copyright Beman Dawes, 2002, 2006, 2007, 2009, 2010, 2011</font></p> +<p><font size="2">Distributed under the Boost Software License, Version 1.0. See +</font> +<a href="http://www.boost.org/LICENSE_1_0.txt"><font size="2">www.boost.org/LICENSE_1_0.txt</font></a></p> +<p><font size="2">Revised +<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->13 January 2012<!--webbot bot="Timestamp" endspan i-checksum="32267" --></font></p> + +$endid + +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/src/build.bat b/libs/filesystem/v3/doc/src/build.bat new file mode 100644 index 0000000000..c787591e8e --- /dev/null +++ b/libs/filesystem/v3/doc/src/build.bat @@ -0,0 +1,5 @@ +@echo off +del tr2.html >nul +mmp TARGET=TR2 source.html tr2.html +del reference.html >nul +mmp TARGET=BOOST source.html reference.html diff --git a/libs/filesystem/v3/doc/src/source.html b/libs/filesystem/v3/doc/src/source.html new file mode 100644 index 0000000000..9f8dd78263 --- /dev/null +++ b/libs/filesystem/v3/doc/src/source.html @@ -0,0 +1,3562 @@ +<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> +$if $TARGET; == BOOST + Filesystem V3 Reference + $def WHAT "reference documentation" + $def SNIPPET_FILE "boost_snippets.html" + $def HEADER "boost/filesystem.hpp" + $def NAMESPACE boost + $def SUBNAMESPACE filesystem + $def NAMESPACE_BEGIN "namespace boost +{ + namespace filesystem + {" + $def NAMESPACE_END " } // namespace filesystem +} // namespace boost" +$else + Filesystem TR2 Proposal + $def WHAT "Clause" + $def SNIPPET_FILE "tr2_snippets.html" + $def HEADER "files" + $def NAMESPACE std + $def SUBNAMESPACE files + $def NAMESPACE_BEGIN "namespace std { namespace tr2 { namespace files { +" + $def NAMESPACE_END "} } } // namespaces std::tr2::files" +$endif +</title> +<style type="text/css"> +$include "../../../../../doc/src/minimal.css" +</style> +</head> + +<body> +$snippet frontmatter "$SNIPPET_FILE;" + +<h2><a name="TOC">Table of Contents</a></h2> + +<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> + <tr> + <td width="33%" valign="top"><a href="#Introduction">Introduction</a><br> + <a href="#Definitions">Definitions</a><br> + <a href="#Conformance">Conformance</a><br> + <a href="#Header-filesystem-synopsis"> + Header <code><$HEADER;></code> synopsis</a><br> + <a href="#Error-reporting">Error reporting</a><br> + <a href="#class-path">Class <code>path</code></a><br> + <a href="#path-Conversions"><code>path</code> conversions</a><br> + <a href="#path-Conversions-to-native-format"><code>path</code> + conversions to native format</a><br> + <a href="#path-Conversions-to-generic-format"><code>path</code> + conversions to generic format</a><br> + <a href="#path-Encoding-conversions"><code>path</code> + encoding conversions</a><br> + <a href="#path-Requirements"><code>path</code> requirements</a><br> + <a href="#path-constructors"><code>path</code> constructors</a><br> + <a href="#path-assignments"><code>path</code> assignments</a><br> + <a href="#path-appends"><code>path</code> appends</a><br> + <a href="#path-modifiers"><code>path</code> modifiers</a><br> + <a href="#path-native-format-observers"><code>path</code> native + format observers</a><br> + <a href="#path-generic-format-observers"><code>path</code> generic + format observers</a><br> + <a href="#path-decomposition"><code>path</code> decomposition</a><br> + <a href="#path-query"><code>path</code> query</a><br> + <a href="#path-iterators"><code>path</code> iterators</a><br> + <a href="#path-deprecated-functions"><code>path</code> deprecated functions</a><br> + <a href="#path-non-member-functions"><code>path</code> non-member functions</a><br> + <a href="#path-inserter-extractor"><code>path</code> inserters and extractors</a><br> + <a href="#Class-filesystem_error">Class <code>filesystem_error</code></a><br> + <a href="#filesystem_error-members"><code>filesystem_error</code> + constructors</a><br> + <code>f</code><a href="#filesystem_error-path1"><code>ilesystem_error</code> path1</a><br> + <a href="#filesystem_error-path2"><code>filesystem_error</code> path2</a><br> + <a href="#filesystem_error-what"><code>filesystem_error</code><code> + </code>what</a></td> + <td width="33%" valign="top"> + <a href="#Enum-file_type">Enum <code>file_type</code></a><br> + <a href="#Enum-perms">Enum <code>perms</code></a><br> + <a href="#file_status">Class + <code>file_status</code></a><br> + + <a href="#file_status"> + <code>file_status</code></a><a href="#file_status-constructors"> constructors</a><br> + <code><a href="#file_status-modifiers">file_status-modifiers</a></code><a href="#directory_entry-observers"> observers</a><br> + <code><a href="#file_status-observers">file_status-observers</a></code><a href="#directory_entry-modifiers"> modifiers</a><br> +<a href="#Class-directory_entry">Class <code>directory_entry</code></a><br> + +<a href="#directory_entry-constructors"><code>directory_entry</code> constructors</a><br> + <a href="#directory_entry-observers"><code>directory_entry</code> observers</a><br> + <a href="#directory_entry-modifiers"><code>directory_entry</code> modifiers</a><br> +<a href="#Class-directory_iterator">Class <code>directory_iterator</code></a><br> + <a href="#directory_iterator-members"><code>directory_iterator</code> + members</a><br> +<a href="#Class-recursive_directory_iterator">Class <code>recursive_directory_iterator</code></a><br> + <a href="#Operational-functions"> + Operational functions</a><br> + <code>   <a href="#absolute">absolute</a><br> + <a href="#canonical">canonical</a><br> + <a href="#copy">copy</a><br> + <a href="#copy_directory">copy_directory</a><br> + <a href="#copy_file">copy_file</a><br> + <a href="#copy_symlink">copy_symlink</a><br> +   <a href="#create_directories">create_directories</a><br> +   <a href="#create_directory">create_directory</a><br> +   <a href="#create_hard_link">create_hard_link</a><br> +   <a href="#create_symlink">create_symlink</a><br> +   <a href="#current_path">current_path</a><br> +   <a href="#exists">exists</a><br> +   <a href="#equivalent">equivalent</a><br> +   <a href="#file_size">file_size</a><br> + <a href="#hard_link_count">hard_link_count</a><br> + <a href="#initial_path">initial_path</a><br> +   i<a href="#is_directory">s_directory</a><br> +   <a href="#is_empty">is_empty</a></code></td> + <td width="34%" valign="top"> + <code>   <a href="#is_other">is_other</a><br> +   <a href="#is_regular_file">is_regular_file</a><br> +   <a href="#is_symlink">is_symlink</a><br> +   <a href="#last_write_time">last_write_time</a><br> + <a href="#permissions">permissions</a><br> + <a href="#read_symlink">read_symlink</a><br> +   <a href="#remove">remove</a><br> +   <a href="#remove_all">remove_all</a><br> +   <a href="#rename">rename</a><br> + <a href="#resize_file">resize_file</a><br> +   <a href="#space">space</a><br> +   <a href="#status">status</a><br> +   <a href="#status_known">status_known</a><br> +   <a href="#symlink_status">symlink_status</a><br> +   <a href="#system_complete">system_complete</a><br> +   <a href="#temp_directory_path">temp_directory_path</a><br> + </code> <code> <a href="#unique_path">unique_path</a></code><br> + <a href="#File-streams">File streams</a><br> +<a href="#Path-decomposition-table">Path decomposition table</a><br> + <a href="#long-path-warning">Warning: Long paths on Windows and the + extended-length <b>\\?\ </b>prefix</a><br> +<a href="#Acknowledgements">Acknowledgements</a><br> +<a href="#References">References</a><br> + </td> + </tr> +</table> + +$snippet wording_prefix "$SNIPPET_FILE;" + +<p>This $WHAT; describes components that perform operations on file systems and +their components, such as paths, regular files, and directories.</p> +<p>Operating systems such as <i>MAC OS, UNIX</i>, and <i>Windows</i> are +mentioned in this $WHAT; for purposes of illustration or to give guidance to +implementers. No slight to other operating systems is implied or intended.</p> +<p><a name="Footnote-3">Footnote 3</a>: <i>MAC OS</i>® is a registered trademark +of Apple Inc.</p> +<p><a name="Footnote-4">Footnote 4</a>: <i>Windows</i>® is a registered +trademark of Microsoft Corporation.</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 "as if" 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>Implementations are not required to provide behavior that is not supported by +a particular file system.</p> +<blockquote> +<p>[<i>Example:</i> The <a href="http://en.wikipedia.org/wiki/FAT_filesystem"> +FAT file system</a> used by some memory cards, camera memory, and floppy discs +does not support hard links, symlinks, and many other features of more capable +file systems. Implementations are only required to support the FAT features +supported by the host operating system. <i>-- end example</i>]</p> +</blockquote> +<p>Specific operating systems such as <i>OpenVMS</i>, +<i>UNIX</i>, and <i>Windows</i> are mentioned only for purposes of illustration or to +give guidance to users and implementers. No slight to other operating systems is implied +or intended. When unlikely to cause confusion, the term <i>POSIX</i> is +sometimes used to refer to "POSIX-compliant operating systems".</p> +<p>The behavior of functions described in this +reference +may differ from their specification in +the presence of <a href="#Race-condition">file system races</a>. No diagnostic is required.</p> +<p>If the possibility of a file system race would make it unreliable for a program to +test for a precondition before calling a function described in this $WHAT;, <i> +Requires</i> is not specified for the condition. Instead, the condition is +specified as a <i>Throws</i> condition.</p> +<blockquote> +<p>[<i>Note:</i> As a design practice, preconditions are not specified when it +is unreasonable for a program to detect them prior to calling the function. <i> +-- end note</i>]</p> +</blockquote> +<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. File types 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 +0x00 +characters are not permitted. Implementations may define additional +characters or specific names that are not permitted. Filenames <code>.</code> +and <code>..</code> have special meaning. Implementations may define +additional filenames that have special meaning.</p> +<blockquote> + <p><i>[Note:</i> Most operating systems prohibit the ASCII control characters + (0x00-0x1F) in filenames.</p> + <p>Windows prohibits the characters 0x00-0x1F, <code>"</code>,<code> + *</code>,<code> :</code>,<code> <</code>,<code> ></code>,<code> ?</code>,<code> + \</code>,<code> /</code>, and<code> |</code> <i>--end note]</i></p> +</blockquote> +<p><b><i><a name="Path">Path</a>:</i></b> A sequence of elements that identify +the location of a file within a filesystem. The elements are the <i>root-name<sub>opt</sub></i>, <i> +root-directory<sub>opt</sub></i>, and an optional sequence of filenames. [<i>Note:</i> +A <a href="#Pathname">pathname</a> is the concrete representation of a path. <i>--end note</i>]</p> +<p><b><i><a name="Absolute-path">Absolute path</a>:</i></b> A path that +unambiguously +identifies the location of a file within a file system without reference to an +additional starting location. 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. <i>--end + note]</i></p> +</blockquote> +<p><i><b><a name="Relative-path">Relative path</a>:</b></i> A path that only +unambiguously +identifies the location of a file within a filesystem when resolved relative to +a starting location. The format is implementation defined. [<i>Note:</i> +Paths "." and ".." are considered to be relative paths. <i>--end note</i>]</p> +<p><i><b><a name="Canonical-path">Canonical path</a>:</b></i> An absolute path that has +no elements which are symbolic links, and no dot or dot dot elements.</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 an implementation defined +native pathname format.</p> +<p><b><i><a name="generic-pathname-format">Generic pathname format:</a></i></b></p> +<blockquote> +<p><i>pathname:<br> + root-name<sub>opt</sub> +root-directory<sub>opt</sub> relative-path<sub>opt</sub></i></p> +<p><i>root-name:<br> + +implementation-defined</i></p> +<blockquote> + <blockquote> +<p>[<i>Note:</i> Most POSIX and Windows based operating systems 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>":"</code> as a root-name identifying a disc drive. <i>--end note</i>]</p> + </blockquote> +</blockquote> +<p><i>root-directory:<br> + +directory-separator</i></p> +<p><i>relative-path:<br> + +filename<br> + relative-path +directory-separator<br> + relative-path +directory-separator filename</i></p> +<p><i>filename:<br> + name<br> + </i><code>"."</code><i><br> + </i><code> +".."</code></p> +<p><i>directory-separator:<br> + <code>"/"<br> + "/"</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>"."</code> is considered to be a reference to the current directory. The +<i>filename</i> <code>".."</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> +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 +"dangling" symbolic link.<i> -- end note</i>]<i> </i></p> +</blockquote> +<p><b><i><a name="Race-condition">File system race</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>"."</code> +and <code>".."</code>, respectively. The dot filename names the current +directory. The dot dot filename names the parent directory.</p> +<h2><a name="Header-filesystem-synopsis">Header <code><$HEADER;></code> synopsis</a></h2> +<pre>$NAMESPACE_BEGIN; + class <a href="#class-path">path</a>; + + void swap(path& lhs, path& rhs); + bool lexicographical_compare(path::iterator first1, path::iterator last1, + path::iterator first2, path::iterator last2); + std::size_t <a href="#hash_value">hash_value</a>(const path& p); + + bool operator==(const path& lhs, const path& rhs); + bool operator!=(const path& lhs, const path& rhs); + bool operator< (const path& lhs, const path& rhs); + bool operator<=(const path& lhs, const path& rhs); + bool operator> (const path& lhs, const path& rhs); + bool operator>=(const path& lhs, const path& rhs); + + path operator/ (const path& lhs, const path& rhs); + + std::ostream& operator<<( std::ostream& os, const path& p ); + std::wostream& operator<<( std::wostream& os, const path& p ); + std::istream& operator>>( std::istream& is, path& p ); + std::wistream& operator>>( std::wistream& is, path& p ) + + class <a href="#Class-filesystem_error">filesystem_error</a>; + class <a href="#Class-directory_entry">directory_entry</a>; + + class <a href="#Class-directory_iterator">directory_iterator</a>; + + class <a href="#Class-recursive_directory_iterator">recursive_directory_iterator</a>; + + enum <a name="file_type" href="#Enum-file_type">file_type</a> + { + status_error, file_not_found, regular_file, directory_file, + symlink_file, block_file, character_file, fifo_file, socket_file, + type_unknown + }; + + enum <a href="#Enum-perms">perms</a> + { + no_perms, + owner_read, owner_write, owner_exe, owner_all, + group_read, group_write, group_exe, group_all, + others_read, others_write, others_exe, others_all, all_all, + set_uid_on_exe, set_gid_on_exe, sticky_bit, + perms_mask, perms_not_known, + add_perms, remove_perms, symlink_perms + }; + + class <a href="#file_status">file_status</a>; + + struct <a name="space_info">space_info</a> // returned by <a href="#space" style="text-decoration: none">space</a> function + { + uintmax_t capacity; + uintmax_t free; + uintmax_t available; // free space available to a non-privileged process + }; + + enum class <a name="copy_option">copy_option</a> + { + none + fail_if_exists = none, + overwrite_if_exists + }; + + enum class <a name="symlink_option">symlink_option</a> + { + none + no_recurse = none, + recurse + }; + + // <a href="#Operational-functions">operational functions</a> + + path <a href="#absolute">absolute</a>(const path& p, const path& base=current_path()); + + path <a href="#canonical">canonical</a>(const path& p, const path& base = current_path()); + path <a href="#canonical">canonical</a>(const path& p, system::error_code& ec); + path <a href="#canonical">canonical</a>(const path& p, const path& base, system::error_code& ec); + + void <a href="#copy">copy</a>(const path& from, const path& to); + void <a href="#copy">copy</a>(const path& from, const path& to, system::error_code& ec); + + void <a href="#create_directory">copy_directory</a>(const path& from, const path& to); + void <a href="#create_directory">copy_directory</a>(const path& from, const path& to, system::error_code& ec); + + void <a href="#copy_file">copy_file</a>(const path& from, const path& to); + void <a href="#copy_file">copy_file</a>(const path& from, const path& to, system::error_code& ec); + void <a href="#copy_file">copy_file</a>(const path& from, const path& to, <a href="#copy_option">copy_option</a> option); + void <a href="#copy_file">copy_file</a>(const path& from, const path& to, <a href="#copy_option">copy_option</a> option, + system::error_code& ec); + + void <a href="#copy_symlink">copy_symlink</a>(const path& existing_symlink, const path& new_symlink); + void <a href="#copy_symlink">copy_symlink</a>(const path& existing_symlink, const path& new_symlink, system::error_code& ec); + + bool <a href="#create_directories">create_directories</a>(const path& p); + bool <a href="#create_directories">create_directories</a>(const path& p, system::error_code& ec); + + bool <a href="#create_directory">create_directory</a>(const path& p); + bool <a href="#create_directory">create_directory</a>(const path& p, system::error_code& ec); + + void <a href="#create_directory_symlink">create_directory_symlink</a>(const path& to, const path& new_symlink); + void <a href="#create_directory_symlink">create_directory_symlink</a>(const path& to, const path& new_symlink, system::error_code& ec); + + void <a href="#create_hard_link">create_hard_link</a>(const path& to, const path& new_hard_link); + void <a href="#create_hard_link">create_hard_link</a>(const path& to, const path& new_hard_link, system::error_code& ec); + + void <a href="#create_symlink">create_symlink</a>(const path& to, const path& new_symlink); + void <a href="#create_symlink">create_symlink</a>(const path& to, const path& new_symlink, system::error_code& ec); + + path <a href="#current_path">current_path</a>(); + path <a href="#current_path">current_path</a>(system::error_code& ec); + void <a href="#current_path">current_path</a>(const path& p); + void <a href="#current_path">current_path</a>(const path& p, system::error_code& ec); + + bool <a href="#exists">exists</a>(file_status s) noexcept; + bool <a href="#exists">exists</a>(const path& p); + bool <a href="#exists">exists</a>(const path& p, system::error_code& ec) noexcept; + + bool <a href="#equivalent">equivalent</a>(const path& p1, const path& p2); + bool <a href="#equivalent">equivalent</a>(const path& p1, const path& p2, system::error_code& ec); + + uintmax_t <a href="#file_size">file_size</a>(const path& p); + uintmax_t <a href="#file_size">file_size</a>(const path& p, system::error_code& ec); + + uintmax_t <a href="#hard_link_count">hard_link_count</a>(const path& p); + uintmax_t <a href="#hard_link_count">hard_link_count</a>(const path& p, system::error_code& ec); + + const path& <a href="#initial_path">initial_path</a>(); + const path& <a href="#initial_path">initial_path</a>(<code>system::error_code& ec</code>); + + bool <a href="#is_directory">is_directory</a>(file_status s) noexcept; + bool <a href="#is_directory2">is_directory</a>(const path& p); + bool <a href="#is_directory2">is_directory</a>(const path& p, system::error_code& ec) noexcept; + + bool <a href="#is_empty">is_empty</a>(const path& p); + bool <a href="#is_empty">is_empty</a>(const path& p, system::error_code& ec); + + bool <a href="#is_other">is_other</a>(file_status s) noexcept; + bool <a href="#is_other2">is_other</a>(const path& p,); + bool <a href="#is_other2">is_other</a>(const path& p, system::error_code& ec) noexcept; + + bool <a href="#is_regular_file">is_regular_file</a>(file_status s) noexcept; + bool i<a href="#is_regular_file2">s_regular_file</a>(const path& p); + bool i<a href="#is_regular_file2">s_regular_file</a>(const path& p, system::error_code& ec) noexcept; + + bool <a href="#is_symlink">is_symlink</a>(file_status s noexcept); + bool <a href="#is_symlink2">is_symlink</a>(const path& p); + bool <a href="#is_symlink2">is_symlink</a>(const path& p, system::error_code& ec) noexcept; + + std::time_t <a href="#last_write_time">last_write_time</a>(const path& p); + std::time_t <a href="#last_write_time">last_write_time</a>(const path& p, system::error_code& ec); + void <a href="#last_write_time2">last_write_time</a>(const path& p, const std::time_t new_time); + void <a href="#last_write_time2">last_write_time</a>(const path& p, const std::time_t new_time, system::error_code& ec); + + path <a href="#read_symlink">read_symlink</a>(const path& p); + path <a href="#read_symlink">read_symlink</a>(const path& p, system::error_code& ec); + + bool <a href="#remove">remove</a>(const path& p); + bool <a href="#remove">remove</a>(const path& p, system::error_code& ec); + + uintmax_t <a href="#remove_all">remove_all</a>(const path& p); + uintmax_t <a href="#remove_all">remove_all</a>(const path& p, system::error_code& ec); + + void <a href="#rename">rename</a>(const path& from, const path& to); + void <a href="#rename">rename</a>(const path& from, const path& to, system::error_code& ec); + + void <a href="#resize_file">resize_file</a>(const path& p, uintmax_t size); + void <a href="#resize_file2">resize_file</a>(const path& p, uintmax_t size, system::error_code& ec); + + <a href="#space_info">space_info</a> <a href="#space">space</a>(const path& p); + <a href="#space_info">space_info</a> <a href="#space">space</a>(const path& p, system::error_code& ec); + + <a href="#file_status">file_status</a> <a href="#status">status</a>(const path& p); + <a href="#file_status">file_status</a> <a href="#status">status</a>(const path& p, system::error_code& ec) noexcept; + + bool <a href="#status_known">status_known</a>(file_status s) noexcept; + + <a href="#file_status">file_status</a> <a href="#symlink_status">symlink_status</a>(const path& p); + <a href="#file_status">file_status</a> <a href="#symlink_status">symlink_status</a>(const path& p, system::error_code& ec) noexcept; + + path <a href="#system_complete">system_complete</a>(const path& p); + path <a href="#system_complete">system_complete</a>(const path& p, system::error_code& ec); + + path <a href="#temp_directory_path">temp_directory_path</a>(); + path <a href="#temp_directory_path">temp_directory_path</a>(system::error_code& ec); + + path <a href="#unique_path">unique_path</a>(const path& model="%%%%-%%%%-%%%%-%%%%"); + path <a href="#unique_path">unique_path</a>(const path& model, system::error_code& ec); + +$NAMESPACE_END;</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> + </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&</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> + </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> + </li> + <li>Destructors throw nothing.</li> + </ul> + <p>Functions having an argument of type +<code>system::error_code&</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&</code> argument is set as + appropriate appropriate for the specific error. Otherwise, <code>clear()</code> + is called on the +<code>system::error_code&</code> argument.<br> + </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 does not necessarily exist in external storage, and the +pathname is not necessarily valid for the current operating +system or for a particular file system.</p> +<blockquote> +<p>[<i>Example:</i> A <a href="#long-path-warning">long path name on Windows</a> +is an example of an innocuous appearing path that is not actually valid. <i>-- +end example</i>]</p> +</blockquote> +<pre>$NAMESPACE_BEGIN; + 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<value_type> string_type; + typedef std::codecvt<wchar_t, char, std::mbstate_t> codecvt_type; + + // <a href="#path-constructors">constructors</a> and destructor + path(); + path(const path& p); + path(path&& p) noexcept; + + template <class <a href="#Source">Source</a>> + path(Source const& source, const codecvt_type& cvt=codecvt()); + + template <class <a href="#InputIterator">InputIterator</a>> + path(InputIterator begin, InputIterator end, const codecvt_type& cvt=codecvt()); + + ~path(); + + // <a href="#path-assignments">assignments</a> + path& operator=(const path& p); + path& operator=(path&& p) noexcept; + + template <class <a href="#Source">Source</a>> + path& operator=(Source const& source); + + template <class <a href="#Source">Source</a>> + path& assign(Source const& source, const codecvt_type& cvt) + + template <class <a href="#InputIterator">InputIterator</a>> + path& assign(InputIterator begin, InputIterator end, const codecvt_type& cvt=codecvt()); + + // <a href="#path-appends">appends</a> + path& operator/=(const path& p); + + template <class <a href="#Source">Source</a>> + path& operator/=(Source const& source); + + template <class <a href="#Source">Source</a>> + path& append(Source const& source, const codecvt_type& cvt); + + template <class <a href="#InputIterator">InputIterator</a>> + path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt=codecvt()); + + // <a href="#path-modifiers">modifiers</a> + void <a href="#path-clear">clear</a>(); + path& <a href="#absolute">make_absolute</a>(const path& base); + path& <a href="#path-make_preferred">make_preferred</a>(); // POSIX: no effect. Windows: convert slashes to backslashes + path& <a href="#path-remove_filename">remove_filename</a>(); + path& <a href="#path-replace_extension">replace_extension</a>(const path& new_extension = path()); + void <a href="#path-swap">swap</a>(path& rhs); + + // <a href="#path-native-format-observers">native format observers</a> + const string_type& <a href="#native">native</a>() const noexcept; // native format, encoding + const value_type* <a href="#c_str">c_str</a>() const noexcept; // native().c_str() + + template <class String> + String <a href="#string-template">string</a>(const codecvt_type& cvt=codecvt()) const; // native format + + const string <a href="#string">string</a>(const codecvt_type& cvt=codecvt()) const; // native format + const wstring <a href="#wstring">wstring</a>(const codecvt_type& cvt=codecvt()) const; // ditto + const u16string <a href="#u16string">u16string</a>() const; // ditto + const u32string <a href="#u32wstring">u32string</a>() const; // ditto + + // <a href="#path-generic-format-observers">generic format observers</a> + template <class String> + String <a href="#generic_string-template">generic_string</a>() const; + + const string <a href="#generic_string">generic_string</a>(const codecvt_type& cvt=codecvt()) const; // generic format + const wstring <a href="#generic_wstring">generic_wstring</a>(const codecvt_type& cvt=codecvt()) const; // ditto + const u16string <a href="#generic_u16string">generic_u16string</a>() const; // ditto + const u32string <a href="#generic_u32wstring">generic_u32string</a>() 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; + + // <a href="#path_encoding">encoding conversion</a> + static std::locale <a href="#path-imbue">imbue</a>( const std::locale& loc ); + static const codecvt_type & <a href="#path-codecvt">codecvt</a>(); + + private: + string_type pathname; // <b><i>exposition only</i></b> + }; + +$NAMESPACE_END;</pre> +<p><code><a name="value_type">value_type</a></code> is an implementation-defined +<code>typedef</code> for the +character type used by the operating system to represent pathnames.</p> +<p>Member functions described as returning <code>const string</code>, <code> +const wstring</code>, <code>const u16string</code>, or <code>const u32string</code> are permitted to return <code>const string&</code>, <code>const +wstring&</code>, <code>const u16string&</code>, or <code>const u32string&</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> +<h3><a name="path-Conversions"><code>path</code> Conversions</a></h3> +<h4><a name="path-Conversions-to-native-format"><code>path</code> Conversions to +native format</a></h4> +<p>Member function arguments that take character sequences representing paths +may use the <a href="#generic-pathname-format">generic pathname format</a> or +the <a href="#native-pathname-format">native pathname format</a>. If such an +argument uses the generic format, an implementation defined conversion to native format is performed +during the processing of the argument. </p> +<blockquote> +<p>[<i>Note:</i> No conversion occurs on POSIX and Windows since they have +native formats that conform to the generic format. <i>--end note</i>]</p> +<p>[<i>Rationale:</i> There is no unambiguous way for an implementation to +always be able distinguish between native format and generic format arguments. +This is by design as it simplifies use. Should an implementation encounter an +operating system where disambiguation is required, an implementation defined +native format prefix can be introduced to identify the native format. <i>-- end +rationale</i>]</p> +</blockquote> + +<table align="center" border="1" cellpadding="3" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td> + 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> + +<p>If the native format requires +paths for regular files to be formatted differently from paths for directories, the +path shall be treated as a directory path if last element is a separator, +otherwise it shall be treated as a regular file path.</p> + +<blockquote> + +<p>[<i>Note</i>: The above paragraph does not apply to POSIX and Windows since +they use the same format +for both regular file and directory pathnames. <i>--end note</i>]</p> + +<p>[<i>Example:</i> +On <a href="http://en.wikipedia.org/wiki/OpenVMS">OpenVMS</a>, a path +constructed from <code>"/cats/jane"</code> would considered a regular file +path, and have a native format of <code>"[CATS]JANE"</code>, while a +path constructed from <code>"/cats/jane/"</code> would be considered a +directory path, and have a native format of <code>"[CATS.JANE]"</code>. +<i>--end example</i>]</p> + +</blockquote> +<h4><a name="path-Conversions-to-generic-format"><code>path</code> Conversions +to generic format</a></h4> +<p><a href="#path-generic-format-observers">Generic format observer</a> +functions return strings formatted according to the +<a href="#generic-pathname-format">generic pathname format</a>. The conversion +from generic to native formats is implementation defined.</p> +<blockquote> +<p>[<i>Note:</i> For POSIX, no conversion is performed. For Windows, backslashes are converted to +forward slashes. <i>-- end note</i>]</p> +</blockquote> +<h4><a name="path-Encoding-conversions"><code>path</code> Encoding conversions</a></h4> +<p>If the value type of member function arguments that are character sequences +representing paths is not <code>value_type</code>, +and no <code>cvt</code> argument is supplied, conversion to <code>value_type</code> +occurs using an imbued locale. This imbued locale is initialized with a <code> +codecvt</code> facet appropriate for the operating system.</p> +<blockquote> +<p>For Apple OS X implementations, <code>path::value_type</code> +is <code>char</code>. The default imbued locale provides a UTF-8 <code>codecvt</code> +facet. [<i>Rationale:</i> "All BSD system functions expect their string +parameters to be in UTF-8 encoding and nothing else." See +<a href="http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html"> +Apple docs</a>. <i>-- end rationale</i>]</p> +<p>For Windows-like implementations, including +<a href="http://www.mingw.org/">MinGW</a>, <code>path::value_type</code> is <code> +wchar_t</code>. The default imbued locale provides a <code>codecvt</code> facet +that invokes Windows <code>MultiByteToWideChar</code> or <code> +WideCharToMultiByte</code> API with a codepage of <code>CP_THREAD_ACP</code> +if Windows <code>AreFileApisANSI()</code>is true, otherwise codepage <code> +CP_OEMCP</code>. [<i>Rationale:</i> this is the current behavior of C and C++ +programs that perform file operations using narrow character string to identify +paths. Changing this in the Filesystem library would be too surprising, +particularly where user input is involved. <i>-- end rationale</i>]</p> +<p>For all other implementations, including<b> </b>Linux, <code>path::value_type</code> +is <code>char</code>. The default imbued locale is <code>std::locale("")</code>. +[<i>Rationale:</i> ISO C specifies this as "the locale-specific native +environment", while POSIX says it "Specifies an implementation-defined native +environment." <i>-- end rationale</i>]</p> +</blockquote> +<h3><a name="path-Requirements"><code>path</code> Requirements</a></h3> +<p>Template parameters named <code><a name="InputIterator">InputIterator</a></code> +are 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>Template parameters named <code><a name="Source">Source</a></code> are 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> + +<h3> <a name="path-constructors"> <code> +<font size="4">path</font></code> constructors</a></h3> +<pre><span style="background-color: #D7EEFF">path();</span></pre> +<blockquote> + <p><i>Postcondition:</i> <code>empty()</code>.</p> + </blockquote> +<pre>template <class <a href="#Source">Source</a>> + path(Source const& source, const codecvt_type& cvt=codecvt());</pre> +<pre>template <class <a href="#InputIterator">InputIterator</a>> + path(InputIterator begin, InputIterator end, const codecvt_type& 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 and the generic format is unacceptable to the operating + system's API, they are converted to the native format. [<i>Note:</i> For + POSIX and Windows 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 [<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 <class <a href="#Source">Source</a>> + path& operator=(Source const& source);</pre> +<pre>template <class <a href="#Source">Source</a>> + path& assign(Source const& source, const codecvt_type& cvt);</pre> +<pre>template <class <a href="#InputIterator">InputIterator</a>> + path& assign(InputIterator begin, InputIterator end, const codecvt_type& 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 [<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& operator/=(const path& 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 <class <a href="#Source">Source</a>> + path& operator/=(Source const & source);</pre> +<pre>template <class <a href="#Source">Source</a>> + path& append(Source const & source, const codecvt_type& cvt);</pre> +<pre>template <class <a href="#InputIterator">InputIterator</a>> + path& append(InputIterator begin, InputIterator end, const codecvt_type& 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 [<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->empty()</code> is true.</p> +</blockquote> +<pre>path& <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& <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> <i>-- end + note</i>]</p> +</blockquote> +<pre>path& <a name="path-replace_extension">replace_extension</a>(const path& 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>void <a name="path-swap">swap</a>(path& rhs) noexcept;</code></pre> +<blockquote> + <p><i>Effects:</i> + Swaps the contents of the two paths.</p> + <p><i>Complexity: </i> + constant time.</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& <a name="native">native</a>() const noexcept;</pre> +<blockquote> +<p><i>Returns:</i> <code>pathname</code>.</p> +</blockquote> +<pre>const value_type* <a name="c_str">c_str</a>() const noexcept;</pre> +<blockquote> +<p><i>Returns:</i> <code>pathname.c_str()</code>.</p> +</blockquote> +<pre>template <class String> +String <a name="string-template">string</a>(const codecvt_type& 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 <a name="string">string</a>(const codecvt_type& cvt=codecvt()) const; +const wstring <a name="wstring">wstring</a>(const codecvt_type& cvt=codecvt()) const; +const u16string <a name="u16string">u16string</a>() const; +const u32wstring <a name="u32wstring">u32wstring</a>() 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&</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 <class String> +String <a name="generic_string-template">generic_string</a>(const codecvt_type& 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 <a name="generic_string">generic_string</a>(const codecvt_type& cvt=codecvt()) const; +const wstring <a name="generic_wstring">generic_wstring</a>(const codecvt_type& cvt=codecvt()) const; +const u16string <a name="generic_u16string">generic_u16string</a>() const; +const u32wstring <a name="generic_u32wstring">generic_u32wstring</a>() 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 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&</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 << path("/foo/bar.txt").filename();</code> // outputs "<code>bar.txt</code>"</pre> + </blockquote> + <p> <i>--end example</i>]</p> +</blockquote> +<pre>path <a name="path-stem">stem</a>(const path& 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 << path("/foo/bar.txt").stem();</code> // outputs "<code>bar</code>" +path p = "foo.bar.baz.tar"; +for (; !p.extension().empty(); p = p.stem()) + std::cout << p.extension() << '\n'; + // outputs: .tar + // .baz + // .bar</pre> + </blockquote> + <p> <i>--end example</i>]</p> +</blockquote> +<pre>path <a name="path-extension">extension</a>(const path& 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 << path("/foo/bar.txt").extension(); //</code> outputs "<code>.txt</code>"</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. <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><i>Returns:</i> <code>true</code> + if the elements of <code>root_path()</code> uniquely identify a directory, else <code>false</code>.</p> + <p>[<i>Note:</i> On POSIX,<code> + path("/foo").is_absolute()</code> returns <code>true</code>. On Windows, <code> + path("/foo").is_absolute()</code> returns <code>false</code>. <i>--end note</i>]</p> +</blockquote> +<pre>bool <a name="path-is_relative">is_relative</a>() const;</pre> +<blockquote> + <p><i>Returns:</i> <code>!is_absolute()</code>.</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_encoding"><code><font size="4"> path</font></code> encoding</a> conversion</h3> + <pre>static std::locale <a name="path-imbue">imbue</a>(const std::locale& loc);</pre> +<blockquote> + <p><i>Effects:</i> Stores <code>loc</code> as the default locale for all + objects of type <code>path</code>.</p> + <p><i>Returns:</i> The previous default locale for all objects of type <code> + path</code>.</p> +</blockquote> +<pre>static const codecvt_type& <a name="path-codecvt">codecvt</a>();</pre> +<blockquote> + <p><i>Returns:</i> The <code>codecvt</code> facet for the default locale for + all objects of type <code>path</code>.</p> +</blockquote> + +$if $TARGET; == BOOST +<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& 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> + +$endif + +<h3> <a name="path-non-member-functions"> <code><font size="4">path</font></code> +non-member functions</a></h3> +<pre>void swap( path& lhs, path& rhs )</pre> +<blockquote> + <p><i>Effects: </i><code> + lhs.swap(rhs)</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 && first2 != last2 ; ++first1, ++first2) { + if (first1->native() < first2->native()) return true; + if (first2->native() < first1->native()) return false; + } + return first1 == last1 && 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>std::size_t <a name="hash_value">hash_value</a> (const path& p);</pre> +<blockquote> + <p><i>Returns:</i> A hash value for the path <code>p</code>. If + for two paths, <code>p1 == p2</code> then + <code>hash_value(p1) == hash_value(p2)</code>.</p> + <p>This allows paths to be used with + <a href="../../../functional/hash/index.html">Boost.Hash</a>.</p> +</blockquote> +<pre>bool operator< (const path& lhs, const path& 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<=(const path& lhs, const path& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>!(rhs < lhs)</code>.</p> +</blockquote> +<pre>bool operator> (const path& lhs, const path& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>rhs < lhs</code>.</p> +</blockquote> +<pre>bool operator>=(const path& lhs, const path& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>!(lhs < rhs)</code>.</p> +</blockquote> +<pre>bool operator==(const path& lhs, const path& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>!(lhs < rhs) && !(rhs < 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("foo") == "bar"</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("foo", "bar")</code> will be <code>true</code> + when both paths resolve to the same file.</p> + <p>Programmers wishing to determine if two paths are "the same" must decide if + "the same" means "the same representation" or "resolve to the same actual + file", and choose the appropriate function accordingly. <i> + -- end note</i>]</p> +</blockquote> +<pre>bool operator!=(const path& lhs, const path& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>!(lhs == rhs)</code>.</p> +</blockquote> +<pre>path operator/ (const path& lhs, const path& 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"> inserter + and extractor</a></h3> +<p> The inserter and extractor delimit the string with double-quotes (<code>"</code>) +to ensure that paths with embedded spaces will round trip correctly. Ampersand (<code>&</code>) +is used as an escape character, so the path can itself contain double quotes.</p> +<pre>template <class Char, class Traits> +std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, + const path& p) +</pre> +<blockquote> + <p><i>Effects:</i> + <code>os << <a href="../../../io/doc/quoted_manip.html"> + boost::io::quoted</a>(p.string<std::basic_string<Char>>(), static_cast<Char>('&'));</code></p> + <p><i>Returns:</i> + <code>os</code></p> +</blockquote> +<pre>template <class Char, class Traits> +inline std::basic_istream<Char, Traits>& operator>>(std::basic_istream<Char, Traits>& is, + path& p) +</pre> +<blockquote> + <p><i>Effects: </i> + <code> std::basic_string<Char> str;<br> + is >> + <a href="../../../io/doc/quoted_manip.html">boost::io::quoted</a>(str, + static_cast<Char>('&'));<br> + p = str;</code></p> + <p><i>Returns:</i> + <code>is</code></p> + </blockquote> +<h3><a name="Class-filesystem_error">Class <code>filesystem_error</code></a></h3> +<pre>$NAMESPACE_BEGIN; + class basic_filesystem_error : public system_error + { + public: + filesystem_error(); + filesystem_error(const filesystem_error&); + <a href="#filesystem_error-2-arg">filesystem_error</a>(const std::string& what_arg, + system::error_code ec); + <a href="#filesystem_error-3-arg">filesystem_error</a>(const std::string& what_arg, + const path& p1, system::error_code ec); + <a href="#filesystem_error-4-arg">filesystem_error</a>(const std::string& what_arg, + const path& p1, const path& p2, system::error_code ec); + + filesystem_error& filesystem_error(const filesystem_error&); + ~filesystem_error(); + + filesystem_error& operator=(const filesystem_error&); + + const path& <a href="#filesystem_error-path1">path1</a>() const; + const path& <a href="#filesystem_error-path2">path2</a>() const; + + const char * <a href="#filesystem_error-what">what</a>() const; + }; +$NAMESPACE_END;</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 +$WHAT;.</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& what_arg, error_code ec);</pre> +<blockquote> + <p><i>Postcondition:</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> + runtime_error::what()</code></td> + <td width="82%" bgcolor="#FFFFFF"> + <code><i>what_arg</i>.c_str()</code></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& what_arg, const path_type& p1, error_code ec);</pre> +<blockquote> + <p><i>Postcondition:</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> + runtime_error::what()</code></td> + <td width="82%"> + <code><i>what_arg</i>.c_str()</code></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%">Reference to stored copy of + <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& what_arg, const path_type& p1, const path_type& p2, error_code ec);</pre> +<blockquote> + <p><i>Postcondition:</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> + runtime_error::what()</code></td> + <td width="82%"> + <u> + <code><i>w</i></code></u><code><i>hat_arg</i>.c_str()</code></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%">Reference to stored copy of + <code>p1</code></td> + </tr> + <tr> + <td width="18%"><code>path2()</code></td> + <td width="82%">Reference to stored copy of + <code>p2</code></td> + </tr> + </table> +</blockquote> +<pre>const path& <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& <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="Enum-file_type">Enum file_type</a></h3> +<p>This enum specifies constants uses to identify file types.</p> +<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111"> + <tr> + <td><b>Constant Name</b></td> + <td><b>Meaning</b></td> + </tr> + <tr> + <td><code>status_error</code></td> + <td>An error occurred while trying to obtain the status of the file. The + file simply not being found is <b><u>not</u></b> considered a status error. + </td> + </tr> + <tr> + <td><code>file_not_found</code></td> + <td>The file could not be found</td> + </tr> + <tr> + <td><code>regular_file</code></td> + <td>Regular file</td> + </tr> + <tr> + <td><code>directory_file</code></td> + <td>Directory file</td> + </tr> + <tr> + <td><code>symlink_file</code></td> + <td>Symbolic link file</td> + </tr> + <tr> + <td><code>block_file</code></td> + <td>Block special file</td> + </tr> + <tr> + <td><code>character_file</code></td> + <td>Character special file</td> + </tr> + <tr> + <td><code>fifo_file</code></td> + <td>FIFO or pipe file</td> + </tr> + <tr> + <td><code>socket_file</code></td> + <td>Socket file</td> + </tr> + <tr> + <td><code>type_unknown</code></td> + <td>The file exists, but it is of a system specific type not covered by any + of the above cases.</td> + </tr> +</table> +<h3><a name="Enum-perms">Enum perms</a></h3> +<p>This enum specifies bitmask constants uses to identify file +permissions. The POSIX standard specifies actual values, and those values have +been adopted here because they are very familiar and ingrained for many POSIX +users.</p> +<blockquote> +<p>Caution: Operating systems do not always support permissions as described in +the table.</p> +<p>There is much variation in the meaning of <code><a href="#sticky_bit"> +sticky_bit</a></code>; do not use it unless you understand what it means for +your operating system.</p> +<p>There is much variation in how operating systems treat symlinks. See <code> +<a href="#symlink_perms">symlink_perms</a></code>.</p> +<p>Windows: All permissions except write are currently ignored. There is only a +single write permission; setting write permission for owner, group, or others +sets write permission for all, and removing write permission for owner, group, +or others removes write permission for all. </p> +</blockquote> +<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111"> + <tr> + <td><b>Name</b></td> + <td align="center"><b>Value<br> + (octal)</b></td> + <td align="center"><b>POSIX<br> + macro</b></td> + <td><b>Definition or notes</b></td> + </tr> + +<tr><td> + <p dir="ltr"><code>no_perms</code></td><td><code>0</code></td><td></td> + <td>There are no permissions set for the file. Note: <code>file_not_found</code> is + <code>no_perms</code> rather than <code>perms_not_known</code></td> +</tr> +<tr><td><code>owner_read</code></td><td><code>0400</code></td><td> <code>S_IRUSR</code></td> + <td> Read permission, owner</td> +</tr> +<tr><td><code>owner_write</code></td><td><code>0200</code></td><td> <code>S_IWUSR</code></td> + <td> Write permission, owner</td> +</tr> +<tr><td><code>owner_exe</code></td><td><code>0100</code></td><td> <code>S_IXUSR</code></td> + <td> Execute/search permission, owner</td> +</tr> +<tr><td><code>owner_all</code></td><td><code>0700</code></td><td> <code>S_IRWXU</code></td> + <td> Read, write, execute/search by owner; <code>owner_read | owner_write | owner_exe</code></td> +</tr> +<tr><td><code>group_read</code></td><td><code>040</code></td><td> <code>S_IRGRP</code></td> + <td> Read permission, group</td> +</tr> +<tr><td><code>group_write</code></td><td><code>020</code></td><td> <code>S_IWGRP</code></td> + <td> Write permission, group</td> +</tr> +<tr><td><code>group_exe</code></td><td><code>010</code></td><td> <code>S_IXGRP</code></td> + <td> Execute/search permission, group</td> +</tr> +<tr><td><code>group_all</code></td><td><code>070</code></td><td> <code>S_IRWXG</code></td> + <td> Read, write, execute/search by group; <code>group_read | group_write | + group_exe</code></td> +</tr> +<tr><td><code>others_read</code></td><td><code>04</code></td><td> <code>S_IROTH</code></td> + <td> Read permission, others</td> +</tr> +<tr><td><code>others_write</code></td><td><code>02</code></td><td> <code>S_IWOTH</code></td> + <td> Write permission, others</td> +</tr> +<tr><td><code>others_exe</code></td><td><code>01</code></td><td> <code>S_IXOTH</code></td> + <td> Execute/search permission, others</td> +</tr> +<tr><td><code>others_all</code></td><td><code>07</code></td><td> <code>S_IRWXO</code></td> + <td>Read, write, execute/search by others; <code>others_read | others_write | others_exe</code></td> +</tr> +<tr><td><code>all_all</code></td><td><code>0777</code></td><td> </td><td><code>owner_all | group_all | others_all</code></td> +</tr> +<tr><td><code>set_uid_on_exe</code></td><td><code>04000</code></td><td> <code>S_ISUID</code></td> + <td> Set-user-ID on execution</td> +</tr> +<tr><td><code>set_gid_on_exe</code></td><td><code>02000</code></td><td> <code>S_ISGID</code></td> + <td> Set-group-ID on execution</td> +</tr> +<tr><td><code><a name="sticky_bit">sticky_bit</a> </code> </td><td><code>01000</code></td><td> <code>S_ISVTX</code></td> + <td> Meaning varies; see <a href="http://en.wikipedia.org/wiki/Sticky_bit">http:en.wikipedia.org/wiki/Sticky_bit</a></td> +</tr> +<tr><td><code><a name="perms_mask">perms_mask</a></code></td><td><code>07777</code></td><td> </td> + <td><code>all_all | set_uid_on_exe | set_gid_on_exe | sticky_bit</code></td> +</tr> +<tr><td><code>perms_not_known</code></td><td><code>0xFFFF</code></td><td></td><td> + The permissions are not known, such as when a <code>file_status</code> object + is created without specifying the permissions</td> +</tr> +<tr><td> + <p dir="ltr"><code>add_perms</code></td><td><code>0x1000</code></td><td></td><td> + <p dir="ltr"><code>permissions()</code> adds the argument permission bits to the + file's current bits</td> +</tr> +<tr><td><code>remove_perms</code></td><td><code>0x2000</code></td><td></td><td> + <code>permissions()</code> removes the argument permission bits from the + file's current bits</td> +</tr> +<tr><td><code><a name="symlink_perms">symlink_perms</a></code></td><td><code>0x4000</code></td><td></td><td> + On POSIX <code>permissions()</code> resolves symlinks unless <code>symlink_perms</code> + is specified. + Meaningless on Windows as <code>permissions()</code> never resolves symlinks. + Meaningless on Mac OS X and some other BSD systems as <code>permissions()</code> + always resolves symlinks. Get over it.</td> +</tr> + +</table> +<h3><a name="file_status">Class file_status</a></h3> +<pre>$NAMESPACE_BEGIN; + class file_status + { + public: + + // <a href="#file_status-constructors">constructors</a> + file_status() noexcept; + explicit file_status(<a href="#file_type">file_type</a> ft, <a href="#Enum-perms">perms</a> prms = perms_not_known) noexcept; + + // compiler generated + file_status(const file_status&) noexcept; + file_status& operator=(const file_status&) noexcept; + ~file_status() noexcept; + + // <a href="#file_status-observers">observers</a> + <a href="#file_type">file_type</a> type() const noexcept; + <a href="#Enum-perms">perms</a> permissions() const noexcept; + + // <a href="#file_status-modifiers">modifiers</a> + void type(<a href="#file_type">file_type</a> ft) noexcept; + void permissions(<a href="#Enum-perms">perms</a> prms) noexcept; + }; +$NAMESPACE_END;</pre> +<p>An object of type <code>file_status</code> stores information about the type +and permissions of a file.</p> +<h4 dir="ltr"><a name="file_status-constructors"><code>file_status</code> +constructors</a></h4> +<pre>explicit file_status() noexcept;</pre> +<blockquote> + <p><i>Postconditions:</i> <code>type() == status_error</code>, <code> + permissions() == perms_not_known</code>.</p> +</blockquote> +<pre>explicit file_status(<a href="#file_type">file_type</a> ft, <a href="#Enum-perms">perms</a> prms = perms_not_known) noexcept;</pre> +<blockquote> + <p><i>Postconditions:</i> <code>type() == ft</code>, <code>permissions() == + prms</code>.</p> +</blockquote> + <h4 dir="ltr"><a name="file_status-observers"><code>file_status</code> + observers</a></h4> +<pre><a href="#file_type">file_type</a> type() const noexcept;</pre> +<blockquote> + <p><i>Returns: </i>The value of <code>type()</code> specified by the <i> + postconditions</i> of the most recent call to a constructor, operator=, or + <code>type(file_type)</code> function.</p> +</blockquote> +<pre><a href="#Enum-perms">perms</a> permissions() const noexcept;</pre> +<blockquote> + <p><i>Returns: </i>The value of <code>permissions()</code> specified by the <i> + postconditions</i> of the most recent call to a constructor, operator=, or + <code>permissions(perms)</code> function.</p> +</blockquote> +<h4 dir="ltr"><a name="file_status-modifiers"><code>file_status</code> modifiers</a></h4> +<pre>void type(<a href="#file_type">file_type</a> ft) noexcept;</pre> +<blockquote> + <p dir="ltr"><i>Postconditions:</i> <code>type() == ft</code>.</p> +</blockquote> +<pre>void permissions(<a href="#Enum-perms">perms</a> prms) noexcept;</pre> +<blockquote> + <p dir="ltr"><i>Postconditions:</i> <code>permissions() == prms</code>.</p> +</blockquote> +<h3><a name="Class-directory_entry">Class <code>directory_entry</code></a></h3> +<div dir="ltr"> +<pre>$NAMESPACE_BEGIN; + class directory_entry + { + public: + + // <a href="#directory_entry-constructors">constructors</a> and destructor + directory_entry(); + directory_entry(const directory_entry&); + explicit directory_entry(const path_type& p, file_status st=file_status(), + file_status symlink_st=file_status()); + ~directory_entry(); + + // <a href="#directory_entry-modifiers">modifiers</a> + directory_entry& operator=(const directory_entry&); + void assign(const path_type& p, file_status st=file_status(), + file_status symlink_st=file_status()); + void replace_filename(const path& p, file_status st=file_status(), + file_status symlink_st=file_status()); + + // <a href="#directory_entry-observers">observers</a> + const path& path() const; + file_status status() const; + file_status status(system::error_code& ec) const; + file_status symlink_status() const; + file_status symlink_status(system::error_code& ec) const; + + bool operator< (const directory_entry& rhs); + bool operator==(const directory_entry& rhs); + bool operator!=(const directory_entry& rhs); + bool operator< (const directory_entry& rhs); + bool operator<=(const directory_entry& rhs); + bool operator> (const directory_entry& rhs); + bool operator>=(const directory_entry& rhs); + private: + path_type m_path; // for exposition only + mutable file_status m_status; // for exposition only; stat()-like + mutable file_status m_symlink_status; // for exposition only; lstat()-like + }; + +$NAMESPACE_END;</pre> +</div> +<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 file system races. <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>Postcondition:</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& p, file_status st=file_status(), file_status symlink_st=file_status());</pre> +<blockquote> + <p><i>Postcondition:</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& p, file_status st=file_status(), file_status symlink_st=file_status());</pre> +<blockquote> + <p><i>Postcondition:</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& p, file_status st=file_status(), file_status symlink_st=file_status());</pre> +<blockquote> + <p><i>Postcondition:</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& path() const;</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path</code></p> +</blockquote> +<pre>file_status status() const; +file_status status(system::error_code& ec) const;</pre> +<blockquote> +<p><i>Effects:</i> +As if,</p> + <blockquote> + <pre>if ( !status_known( m_status ) ) +{ + if ( status_known(m_symlink_status) && !is_symlink(m_symlink_status) ) + { m_status = m_symlink_status; } + else { m_status = status(m_path<i>[, ec]</i>); } +}</pre> + </blockquote> + <p><i>Returns:</i> <code>m_status</code></p> + + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + +</blockquote> +<pre>file_status symlink_status() const; +file_status symlink_status(system::error_code& ec) const;</pre> +<blockquote> +<p> + <i>Effects:</i> +As if,</p> + <blockquote> + <pre>if ( !status_known( m_symlink_status ) ) +{ + m_symlink_status = symlink_status(m_path<i>[, ec]</i>); +}</pre> + </blockquote> + <p><i>Returns:</i> <code> + m_symlink_status</code></p> + + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + +</blockquote> +<pre>bool operator==(const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path == + rhs.m_path</code>.</p> +</blockquote> +<pre>bool operator!=(const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path != + rhs.m_path</code>.</p> +</blockquote> +<pre>bool operator< (const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path < + rhs.m_path</code>.</p> +</blockquote> +<pre>bool operator<=(const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path <= + rhs.m_path</code>.</p> +</blockquote> +<pre>bool operator> (const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path > + rhs.m_path</code>.</p> +</blockquote> +<pre>bool operator>=(const directory_entry& rhs);</pre> +<blockquote> + <p><i>Returns:</i> <code>m_path >= + rhs.m_path</code>.</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_BEGIN; + class directory_iterator + { + public: + // <a href="#directory_iterator-members">member functions</a> + + directory_iterator() noexcept; // creates the "end" iterator + directory_iterator(const directory_iterator&); + explicit directory_iterator(const path& p); + directory_iterator(const path& p, system::error_code& ec); + ~directory_iterator(); + + directory_iterator& operator=(const directory_iterator&); + + directory_iterator& operator++(); + directory_iterator& increment(system::error_code& ec); + + // other members as required by + // C++ Std, 24.1.1 Input iterators [input.iterators] + }; + +$NAMESPACE_END;</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&</code> is returned. The result of +<code>operator-></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>() +noexcept;</code></p> + +<blockquote> + +<p><i>Effects:</i> Constructs the end iterator.</p> + +</blockquote> + +<pre><code>explicit <a name="directory_iterator-ctor-path">directory_iterator</a>(</code>const path& p<code>); +directory_iterator(</code>const path& p, system::error_code& 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(".")</code> rather than <code>directory_iterator("")</code>. +<i>-- end note</i>]</p> +</blockquote> +<pre>directory_iterator& <a name="directory_iterator-increment">operator++</a>(); +directory_iterator& increment(system::error_code& 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>recursive_directory_iterator</code> provide standard library +compliant iteration over the contents of a directory, including recursion into +its sub-directories.</p> +<pre>$NAMESPACE_BEGIN; + class recursive_directory_iterator : + public iterator<input_iterator_tag, directory_entry> + { + public: + + // constructors and destructor + recursive_directory_iterator() noexcept; + recursive_directory_iterator(const recursive_directory_iterator&); + explicit recursive_directory_iterator(const path& p, + <a href="#symlink_option">symlink_option</a> opt = symlink_option::none); + recursive_directory_iterator(const path& p, + <a href="#symlink_option">symlink_option</a> opt, system::error_code& ec); + recursive_directory_iterator(const path& p, system::error_code& ec); + ~recursive_directory_iterator(); + + // observers + int level() const noexcept; + bool no_push<code>_pending</code>() const noexcept; + + // modifiers + recursive_directory_iterator& operator=(const recursive_directory_iterator&); + + recursive_directory_iterator& operator++(); + recursive_directory_iterator& increment(system::error_code& ec); + + void pop(); + void no_push(bool value=true); + + // other members as required by + // C++ Std, Input iterators [input.iterators] + + private: +<i><b> // actual data members will probably be stored in a shared object, + // or some similar mechanism, to achieve the required input iterator + // copy semantics +</b></i> int m_level; <b><i> // for exposition only</i></b> + bool m_no_<code>push</code>; <i><b>// for exposition only + </b></i><a href="#symlink_option">symlink_option</a> m_options; <i><b>// for exposition only</b></i> + }; + +$NAMESPACE_END;</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>Incrementing a <code>recursive_directory_iterator</code> pointing to a + directory causes that directory itself to be iterated ovee, as specified by + the <code>operator++</code> and <code>increment</code> functions.<br> + </li> + <li>When a <code>recursive_directory_iterator</code> 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 of the parent directory continues.</li> +</ul> +<pre>recursive_directory_iterator() noexcept;</pre> +<blockquote> + +<p><i>Effects:</i> Constructs the end iterator.</p> + +</blockquote> + +<pre>explicit recursive_directory_iterator(const path& p, <a href="#symlink_option">symlink_option</a> opt = symlink_option::none); +recursive_directory_iterator(const path& p, <a href="#symlink_option">symlink_option</a> opt, system::error_code& ec); +recursive_<code>directory_iterator(</code>const path& p, system::error_code& 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 dir="ltr"><i>Postcondition: </i>Unless the end iterator was constructed,<i> </i> +<code>level() == 0 && no_push_pending() == false && m_options == opt</code>. +For the signature without a <code>symlink_option</code> argument, <code>opt</code> +is assumed to be <code>symlink_option::none</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(".")</code> rather than +<code>recursive_directory_iterator("")</code>. +<i>-- end note</i>]</p> + +<p>[<i>Note:</i> By default, <code>recursive_directory_iterator</code> does not +follow directory symlinks. To follow directory symlinks, specify <code>opt</code> +as <code>symlink_option::recurse</code> +<i>-- end note</i>]</p> +</blockquote> +<pre>int level() const noexcept;</pre> +<blockquote> + <p><i>Requires:</i> <code>*this != recursive_directory_iterator()</code>.</p> + <p><i>Returns:</i> <code>m_level</code>.</p> +</blockquote> +<pre>bool <code>no_push_pending</code>() const noexcept;</pre> +<blockquote> + <p><i>Requires:</i> <code>*this != recursive_directory_iterator()</code>.</p> + <p><i>Returns:</i> <code>m_no_push</code>.</p> +</blockquote> +<pre><code>recursive_directory_iterator</code>& <a name="recursive_directory_iterator-increment">operator++</a>(); +recursive_directory_iterator& increment(system::error_code& ec);</pre> +<blockquote> + +<p><i>Effects:</i> As specified by the C++ Standard, 24.1.1 Input iterators [input.iterators], +except:</p> + +<ul> + <li dir="ltr"> + +<p dir="ltr">if <code>!no_push_pending() && is_directory(this->status()) +&& (!is_symlink(this->symlink_status()) || (m_options +& symlink_option::recurse) != 0)</code> then <code>m_level</code> +is incremented and directory <code>(*this)->path()</code> is recursively iterated into.<br> + </p> + + </li> + <li>if there are no more directory entries at this level then <code>m_level</code> +is decremented and iteration of the parent directory resumes.</li> +</ul> + +<p><i>Postcondition:</i> <code>no_push_pending() == 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> +</blockquote> +<pre>void no_push(bool value=true);</pre> +<blockquote> + <p><i>Requires:</i> <code>*this != recursive_directory_iterator()</code>.</p> +<p><i>Postcondition:</i> <code>no_push_pending() == value</code>.</p> + <p>[<i>Note:</i> <code>no_push()</code> is used to prevent + unwanted recursion into a directory. <i>--end note</i>]</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>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">file system races</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. 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& p, const path& base=current_path());</pre> + <blockquote> + <p><i>Returns:</i> A <a href="#Absolute-path">absolute path</a> composed according to the + following table</p> + <table border="1" cellpadding="5" cellspacing="0" bordercolor="#111111" style="border-collapse: collapse"> + <tr> + <td align="center"> </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 dir="ltr">[<i>Note:</i> For the returned path, <code>rp,</code> <code> + rp.is_absolute()</code> is true. <i>-- end note</i>]</p> + <p><i>Throws:</i> If <code>base.is_absolute()</code> is true, throws only if + memory allocation fails.</p> +</blockquote> +<pre>path <a name="canonical">canonical</a>(const path& p, const path& base = current_path()); +path canonical(const path& p, system::error_code& ec); +path canonical(const path& p, const path& base, system::error_code& ec);</pre> +<blockquote> +<p><i>Overview:</i> Converts <code>p</code>, which must exist, to an absolute +path that has no symbolic link, <a href="#Dot">dot</a>, +or <a href="#Dot">dot-dot</a> elements. </p> +<p><i>Returns:</i> A <a href="#Canonical-path">canonical path</a> that refers to +the same file system object as <code>absolute(p,base)</code>. For the overload +without a <code>base</code> argument, <code>base</code> is <code>current_path()</code>.</p> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + + <p><i>Remarks:</i> <code>!exists(p)</code> is an error.</p> + + <p>[<i>Note:</i> Canonical pathnames allow security checking of a path (eg. + does this path live in /home/goodguy or /home/badguy?) -- end note]</p> + +</blockquote> +<pre>void <a name="copy">copy</a>(const path& from, const path& to); +void copy(const path& from, const path& to, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> As if</p> + + <blockquote> + <pre>file_status s(symlink_status(from<i>[</i><code>, ec</code><i>]</i>)); +if(is_symlink(s)) + copy_symlink(from, to<i>[</i><code>, ec</code><i>]</i>); +else if(is_directory(s)) + copy_directory(from, to<i>[</i><code>, ec</code><i>]</i>); +else if(is_regular_file(s)) + copy_file(from, to, copy_option::fail_if_exists<i>[</i><code>, ec</code><i>]</i>); +else +<i> Report error as specified in <a href="#Error-reporting">Error reporting</a>.</i></pre> + </blockquote> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + +</blockquote> +<pre>void <a name="copy_directory">copy_directory</a>(const path& from, const path& to); +void copy_directory(const path& from, const path& to, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects: </i></p> + + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + +</blockquote> +<pre>void copy_file(const path& from, const path& to); +void copy_file(const path& from, const path& to, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects: </i><code>copy_file(from, to, + copy_option::fail_if_exists</code><i>[</i><code>, ec</code><i>]</i><code>)</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& from, const path& to, <a href="#copy_option">copy_option</a> option); +void <a name="copy_file2">copy_file</a>(const path& from, const path& to, <a href="#copy_option">copy_option</a> option, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> If <code>option == copy_option::</code><code>fail_if_exists + && exists(to)</code>, an error is reported. Otherwise, the 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>void <a name="copy_symlink">copy_symlink</a>(const path& existing_symlink, const path& new_symlink); +void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects: </i><code>create_symlink(read_symlink(existing_symlink</code><i>[</i><code>, ec</code><i>]</i><code>), + new_symlink</code><i>[</i><code>, ec</code><i>]</i><code>)</code>.</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& p); +bool <a name="create_directories2">create_directories</a>(const path& p, system::error_code& 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>Postcondition:</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& p); +bool <a name="create_directory2">create_directory</a>(const path& p, system::error_code& 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>void <a name="create_directory_symlink">create_directory_symlink</a>(const path& to, const path& new_symlink); +void create_directory_symlink(const path& to, const path& new_symlink, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> + Establishes the postcondition, as if by <i> + POSIX</i> + <code> + <a href="http://www.opengroup.org/onlinepubs/000095399/functions/symlink.html"> + symlink()</a></code>.</p> + <p><i> + Postcondition:</i> <code>new_symlink</code> resolves to a symbolic link file that + contains an unspecified representation of <code>to</code>.</p> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + <p dir="ltr">[<i>Note:</i> + Some operating systems, such as Windows, require symlink creation to + identify that the link is to a directory. Portable code should use <code> + create_directory_symlink()</code> to create directory symlinks rather than + <code>create_symlink()</code> <i>-- end note</i>]</p> + <p>[<i>Note:</i> + Some operating systems do not support symbolic links at all or support + them only for regular files. + Some file systems do not + support + symbolic links regardless of the operating system - the FAT file system used on + memory cards and flash drives, for example. <i>-- end note</i>]</p> + </blockquote> +<pre>void <a name="create_hard_link">create_hard_link</a>(const path& to, const path& new_hard_link); +void <a name="create_hard_link2">create_hard_link</a>(const path& to, const path& new_hard_link, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> Establishes the postcondition, as if by + <i>POSIX</i> + <code> + <a href="http://www.opengroup.org/onlinepubs/000095399/functions/link.html"> + link()</a></code>.</p> + <p><i>Postcondition:</i></p> + <ul> + <li> <code>exists(to) && + exists(</code><code>new_hard_link</code><code>) && equivalent(to, + + </code><code>new_hard_link</code><code>)</code></li> + <li>The contents of the file or directory + <code>to</code> resolves to are unchanged.</li> + </ul> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + <p>[<i>Note:</i> + Some operating systems do not support hard links at all or support + them only for regular files. Some file systems do not support hard + links regardless of the operating system - the FAT file system used on memory + cards and flash drives, for example. Some file systems limit the number of + links per file. <i>-- end note</i>]</p> + </blockquote> +<pre>void <a name="create_symlink">create_symlink</a>(const path& to, const path& new_symlink); +void <a name="create_symlink2">create_symlink</a>(const path& to, const path& new_symlink, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> + Establishes the postcondition, as if by <i> + POSIX</i> + <code> + <a href="http://www.opengroup.org/onlinepubs/000095399/functions/symlink.html"> + symlink()</a></code>.</p> + <p><i> + Postcondition:</i> <code>new_symlink</code> resolves to a symbolic link file that + contains an unspecified representation of <code>to</code>.</p> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + <p>[<i>Note:</i> + Some operating systems do not support symbolic links at all or support + them only for regular files. + Some file systems do not + support + symbolic links regardless of the operating system - the FAT system used on + memory cards and flash drives, for example. <i>-- end note</i>]</p> + </blockquote> +<pre>path <a name="current_path">current_path</a>(); +path <a name="current_path2">current_path</a>(system::error_code& 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. <i>-- end note</i>]</p> +</blockquote> +<pre>void current_path(const path& p); +void current_path(const path& p, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> + Establishes the postcondition, as if by <i> + POSIX</i> + <code> + <a href="http://www.opengroup.org/onlinepubs/000095399/functions/chdir.html"> + chdir()</a></code>.</p> +<p><i>Postcondition:</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. <i>-- end note</i>]</p> +</blockquote> +<pre>bool <a name="exists">exists</a>(file_status s) noexcept;</pre> +<blockquote> + <p><i>Returns:</i> + <code>status_known(s) && s.type() != file_not_found</code></p> +</blockquote> +<pre>bool <a name="exists2">exists</a>(const path& p); +bool <a name="exists3">exists</a>(const path& p, system::error_code& ec) noexcept;</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&</code> throws +nothing.</p> +</blockquote> +<pre><code>bool <a name="equivalent">equivalent</a>(const path& p1, const path& p2); +bool <a name="equivalent2">equivalent</a>(const path& p1, const path& p2, system::error_code& ec);</code></pre> +<blockquote> + <p><i>Effects:</i> Determines <code>file_status s1</code> + and <code>s2</code>, as if by <code>status(p1)</code> and <code>status(p2)</code>, + respectively.</p> + <p><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>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>[<i>Note:</i> <i>POSIX</i> requires that <i>"st_dev</i> + must be unique within a Local Area Network". 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 "same" 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><i>Throws:</i> <code>filesystem_error</code> + if <code>(!exists(s1) && !exists(s2)) || (is_other(s1) && is_other(s2))</code>, + otherwise as specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> +</blockquote> +<div dir="ltr"> +<pre>uintmax_t <a name="file_size">file_size</a>(const path& p); +uintmax_t <a name="file_size2">file_size</a>(const path& p, system::error_code& ec);</pre> +</div> +<blockquote> + <p><i>Returns:</i> If <code>exists(p) && is_regular_file(p)</code>, the size + in bytes + 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<uintmax_t>(-1)</code>.</p> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> +</blockquote> +<pre>uintmax_t <a name="hard_link_count">hard_link_count</a>(const path& p); +uintmax_t hard_link_count(const path& p, system::error_code& ec);</pre> +<blockquote> + + <p><i>Returns:</i> The number of hard links for <code>p</code>.</p> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> + +</blockquote> + +<pre>const path& <a name="initial_path">initial_path</a>(); +const path& <a name="initial_path">initial_path</a>(<code>system::error_code& ec</code>);</pre> +<blockquote> + <p><i>Returns:</i> + <code>current_path()</code> as of the first call to <code>initial_path()</code>.</p> + <p>[<i>Note:</i> <code> + initial_path()</code> is not thread safe, and may return an undesirable result + if called subsequent to a change to the current directory. These problems can + be avoided by calling <code>initial_path()</code> immediately on entry to + main(). <i>--end note</i>]</p> + <p><i>Throws:</i> For the first call, as specified in + <a href="#Error-reporting"> + Error reporting</a>. Subsequent calls throw nothing.</p> +</blockquote> +<pre>bool <code><a name="is_directory">is_directory</a></code>(file_status s) noexcept;</pre> +<blockquote> + <p><i>Returns:</i> + <code>s.type() == directory_file</code></p> +</blockquote> +<pre><code>bool <a name="is_directory2">is_directory</a>(const path& p); +bool <a name="is_directory3">is_directory</a>(const path& p, system::error_code& ec) noexcept;</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&</code> throws +nothing.</p> +</blockquote> +<pre><code>bool <a name="is_empty">is_empty</a>(const path& p); +bool <a name="is_empty2">is_empty</a></a>(const path& p, system::error_code& 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> + ? + directory_iterator(p) == directory_iterator()<br> + : file_size(p) == 0;</code></p> +</blockquote> +<pre>bool <code><a name="is_regular_file">is_regular_file</a></code>(file_status s) noexcept;</pre> +<blockquote> + <p><i>Returns:</i> + <code>s.type() == regular_file</code></p> +</blockquote> +<pre><code>bool <a name="is_regular_file2">is_regular_file</a>(const path& 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& p, system::error_code& ec) noexcept;</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> +</blockquote> +<pre>bool <a name="is_other">is_other</a>(file_status s) noexcept;</pre> +<blockquote> + <p><i>Returns:</i> + <code>return exists(s) && !is_regular_file(s) && !is_directory(s) && !is_symlink(s)</code></p> +</blockquote> +<pre><code>bool <a name="is_other2">is_other</a>(const path& p); +bool <a name="is_other3">is_other</a>(const path& p, system::error_code& ec) noexcept;</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&</code> throws + nothing.</p> +</blockquote> +<pre>bool <a name="is_symlink">is_symlink</a>(file_status s) noexcept;</pre> +<blockquote> + <p><i>Returns:</i> + <code>s.type() == symlink_file</code></p> +</blockquote> +<pre><code>bool <a name="is_symlink2">is_symlink</a>(const path& p); +bool <a name="is_symlink3">is_symlink</a>(const path& p, system::error_code& ec) noexcept;</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&</code> throws + nothing.</p> +</blockquote> +<pre>std::time_t <a name="last_write_time">last_write_time</a>(const path& p); +std::time_t <a name="last_write_time2">last_write_time</a>(const path& p<code>, system::error_code& 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> obtained + as if by <i>POSIX</i> <code> + <a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">stat()</a></code>.</p> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> +</blockquote> +<pre>void <a name="last_write_time3">last_write_time</a>(const path& p, const std::time_t new_time); +void <a name="last_write_time4">last_write_time</a>(const path& p, const std::time_t new_time<code>, system::error_code& 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>void <a name="permissions">permissions</a>(const path& p, <a href="#symlink_perms">perms</a> prms); +void permissions(const path& p, <a href="#symlink_perms">perms</a> prms, system::error_code& ec);</pre> +<blockquote> + <p dir="ltr"> + <i>Requires:</i> <code>!((prms & add_perms) && (prms & remove_perms))</code>.</p> + <p dir="ltr"><i>Effects:</i> Applies the effective permissions bits from <code> + prms</code> to the file <code>p</code> resolves to, as if by <i>POSIX</i> + <code> + <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchmodat.html"> + fchmodat()</a></code>. The effective permission bits are determined as + specified by the following table. </p> + <table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111"> + <tr> + <td><b>bits present in <code>prms</code></b></td> + <td><b>Effective bits applied</b></td> + </tr> + <tr> + <td>Neither <code>add_perms</code> nor <code>remove_perms</code></td> + <td><code>prms & perms_mask</code></td> + </tr> + <tr> + <td><code>add_perms</code></td> + <td> + <p dir="ltr"><code>status(p).permissions() | (prms & + <a href="#perms_mask">perms_mask</a>)</code> + </td> + </tr> + <tr> + <td><code>remove_perms</code></td> + <td><code>status(p)</code><code>.permissions() & ~(prms & + <a href="#perms_mask">perms_mask</a>) + </code> </td> + </tr> + </table> + <p>[<i>Note:</i> Conceptually permissions are viewed as bits, but the actual + implementation may use some other mechanism. -- <i>end note</i>]</p> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</p> +</blockquote> +<pre>path <a name="read_symlink">read_symlink</a>(const path& p); +path read_symlink(const path& p, system::error_code& ec);</pre> +<blockquote> + <p dir="ltr"><i>Returns:</i> 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& p); +bool <a name="remove2">remove</a>(const path& p, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> 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> <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& p); +uintmax_t <a name="remove_all2">remove_all</a>(const path& p, system::error_code& ec);</pre> +<blockquote> + <p><i>Effects:</i> 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& old_p, const path& new_p); +void <a name="rename2">rename</a>(const path& old_p, const path& new_p, system::error_code& 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& p, uintmax_t new_size); +void <a name="resize_file2">resize_file</a>(const path& p, uintmax_t new_size, system::error_code& ec);</pre> +<blockquote> +<p><i>Postcondition:</i> <code>file_size() == new_size</code>.</p> +<p><i>Throws:</i> As specified in +<a href="#Error-reporting"> +Error reporting</a>.</p> + <p><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>space_info <a name="space">space</a>(const path& p); +space_info <a name="space2">space</a>(const path& p, system::error_code& ec);</pre> +<blockquote> + <p><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 <i>POSIX</i> <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.</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& 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& p, system::error_code& ec) noexcept;</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>. <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> + </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> + </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. <i>--end note</i>]</p> + </blockquote> + <p>Otherwise,</p> + <ul> + <li>If the attributes indicate a regular file, as if by <i>POSIX</i> <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><fstream></code> operations + would succeed, assuming no hardware, permission, access, or file system + race + errors. Lack of +<code>regular_file</code> does not necessarily imply <code><fstream></code> operations would +fail on a directory. +<i>-- end note</i>]<br> + </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> + </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> + </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> + </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> + </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> + </li> + <li>Otherwise, return <code> + file_status(type_unknown)</code>.</li> + </ul> + </blockquote> + <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>bool <a name="status_known">status_known</a>(file_status s) noexcept;</pre> +<blockquote> + <p><i>Returns:</i> + <code>s.type() != status_error</code></p> +</blockquote> +<pre>file_status <a name="symlink_status">symlink_status</a>(const path& p); +file_status <a name="symlink_status2">symlink_status</a>(const path& p, system::error_code& ec) noexcept;</pre> +<blockquote> + <p><i>Effects:</i> 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>Remarks:</i> Pathname resolution terminates if <code>p</code> names a symbolic link.</p> + <p><i>Throws:</i> <code>filesystem_error</code>; overload with <code>error_code&</code> throws + nothing.</p> +</blockquote> +<pre>path <a name="system_complete">system_complete</a>(const path& p); +path <a name="system_complete2">system_complete</a>(const path& p, system::error_code& 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>Postcondition:</i> For the returned path, <code>rp,</code> <code> + rp.is_absolute()</code> is true.</p> + <p><i>Throws:</i> As specified in + <a href="#Error-reporting"> + Error reporting</a>.</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="temp_directory_path">temp_directory_path</a>(); +path temp_directory_path(system::error_code& ec);</pre> +<blockquote> + <p><i>Returns:</i> A directory path suitable for temporary files under the + conventions of the operating system. The specifics of how this path is + determined are implementation defined. An error shall be reported if<code> !exists(p) + || !is_directory(p)</code>, where <code>p</code> is the path to be returned.</p> + <p><i>POSIX:</i> The path supplied by the first environment variable found in the + list TMPDIR, TMP, TEMP, TEMPDIR. If none of these are found, <code>"/tmp"</code>.</p> + <p><i>Windows:</i> The path reported by the <i>Windows</i> <code>GetTempPath</code> API function.</p> + <p><i>Throws:</i> As specified in <a href="#Error-reporting"> + Error reporting</a>.</p> + <p>[<i>Note: </i>The <code>temp_directory_path()</code> name was chosen to emphasize that the return is a + path, not just a single directory name. <i>-- end note</i>]</p> +</blockquote> +<pre>path <a name="unique_path">unique_path</a>(const path& model="%%%%-%%%%-%%%%-%%%%"); +path unique_path(const path& model, system::error_code& 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> +$snippet wording_suffix "$SNIPPET_FILE;" + +<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> +<table border="1" cellspacing="0" cellpadding="5"> +<p> +<tr><td><b>Constructor<br>argument</b></td> +<td><b>Iteration<br>over<br>Elements</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> +<h2><a name="long-path-warning"></a>Warning: Long paths on Windows and the +extended-length <b>\\?\ </b>prefix</h2> +<p>The Microsoft Windows "Maximum Path Length Limitation" specifies:</p> +<blockquote> +<p>In the Windows API (with some exceptions ...), the maximum length for a path +is MAX_PATH, which is defined as 260 characters.</p> +<p>The Windows API has many functions that also have Unicode versions to permit +an extended-length path for a maximum total path length of 32,767 characters. +... To specify an extended-length path, use the <b>"\\?\" prefix</b>. For +example, "\\?\D:\<em>very long path</em>". +<i>[C++ string literals require backslashes be doubled, of course.]</i></p> +</blockquote> +<p>Because most Boost.Filesystem operational functions just pass the contents of +a class path object to the Windows API, they do work with the extended-length +prefixes. But some won't work, because to the limitations imposed by Windows. +Read the following cautions carefully!</p> +<h3>Cautions for paths with extended-length prefixes</h3> +<ul> + <li>Individual components of a path are still are limited to whatever is + supported for the particular filesystem, commonly 255 characters.</li> + <li>Only backslashes only are acceptable as directory separators. Slashes are + not treated as separators.</li> + <li>All paths must be absolute - relative paths are not allowed.</li> + <li>Once an absolute path grows beyond 260 characters, it is essentially + poisoned and all operations must use extended-length prefixes. So even a + simple operation like <code>create_directory("a")</code> will fail if the + absolute path of the resulting directory would exceed 260 characters.</li> + <li>Certain Boost.Filesystem functions that decompose their argument path and + then work on individual relative directories or files will not work properly + with extended-length prefix paths.</li> +</ul> +<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. The temp_directory_path function was +contributed by Jeff Flinn. David Svoboda suggested the canonical function and +provided psuedo-code.</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 Std 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> +$snippet backmatter "$SNIPPET_FILE;" +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/src/tr2_snippets.html b/libs/filesystem/v3/doc/src/tr2_snippets.html new file mode 100644 index 0000000000..d01df92b2b --- /dev/null +++ b/libs/filesystem/v3/doc/src/tr2_snippets.html @@ -0,0 +1,310 @@ +<html> + +<head> +<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>New Page 1</title> +</head> + +<body> + +$id frontmatter= + <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="579"> + <tr> + <td width="153" align="left" valign="top">Document number:</td> + <td width="426">N3335=12-0025</td> + </tr> + <tr> + <td width="153" align="left" valign="top">Date:</td> + <td width="426"> + <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y-%m-%d" startspan -->2012-01-13<!--webbot bot="Timestamp" endspan i-checksum="12045" --></td> + </tr> + <tr> + <td width="153" align="left" valign="top">Project:</td> + <td width="426">Programming Language C++, Library Working Group</td> + </tr> + <tr> + <td width="153" align="left" valign="top">Reply-to:</td> + <td width="426">Beman Dawes <bdawes at acm dot org></td> + </tr> + </table> + + +<h1>Filesystem Library for C++11/TR2 (Revision 1)</h1> + + +<p>This paper proposes that the filesystem library component of <i>C++ Standard +Library Technical Report 2</i> be based on Version 3 of the Boost Filesystem +Library (see <a href="http://www.boost.org/libs/filesystem"> +www.boost.org/libs/filesystem</a>). Preliminary wording is provided. A +<a href="#TODO">TODO</a> list identifies remaining work to be done.</p> + + +<h2>Revision history</h2> + + +<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3335.html"> +N3335=12-0025</a>, Filesystem Library for C++11/TR2 (Revision 1). Changes +include:</p> + + + <ul> + <li>Regenerated the proposed wording from the Boost Filesystem library + reference documentation, using an automated process. This process reduces + the likelihood of inadvertent discrepancies between descriptions.</li> + <li>An <a href="#Issues-List">Issues list</a> was added, seeded with issues + raised by the LWG review of N3239 at the Bloomington meeting, and private + communications from LWG members.</li> + <li>Namespace changed to <code>files</code> as an experiment. Made this + issue number 1 so the LWG can pass judgement.</li> + <li>New functions were added, suggested by David Svoboda, to generate + canonical paths and manage permissions.</li> + <li>More C++11 functionality was applied. This process is still incomplete, + however.</li> + <li>Added proposed changes to header <fstream>. The previous paper had + inadvertently supplied the wrong wording.</li> + <li>Continued the general cleanup of wording.</li> +</ul> + + +<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3239.html"> +N3239 = 11-0009</a>, Filesystem Library Update for TR2 (Preliminary), reflected +changes made to the Boost library version 3 since the previously accepted +committee paper:</p> + + + <ul> + <li>A single class <code>path</code> handles all aspects of + internationalization, replacing the previous template and its <code>path</code> + and <code>wpath</code> instantiations. Character types <code>char</code>, + <code>wchar_t</code>, <code>char16_t</code>, and <code>char32_t</code> are + supported. This is a major simplification of the path abstraction, + particularly for functions that take path arguments. This change was based + on a suggestion by Peter Dimov.</li> + <li>Several operational functions have been added, including much better + symlink support, the ability to resize a file, and the ability to generate a + unique path.</li> + <li>Support for error reporting via <code>error_code</code> is now uniform + throughout the operations functions.</li> + <li>Several functions have been renamed, based on feedback from users.</li> + </ul> + + +<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1975.html"> +N1975 = 06-0045</a>, Filesystem Library Proposal for TR2 (Revision 3), was +adopted by the committee in April, 2006, at the Berlin meeting. Shortly +afterward the Library Working Group set aside work on TR2 to concentrate on +C++0x.</p> + + +<h2>Motivation and Scope</h2> + + +<p>The motivation and scope for a filesystem library were described in <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1975.html"> +N1975</a>, and are not repeated here. A minor scope reduction is that an +addition to the current C++ runtime library is no longer needed.</p> + + +<p>Boost Filesystem Version 3 introduced a single path type that interoperates well with both <code> +basic_string</code> and user defined string types. Thus the following Design +alternatives paragraph is no long applicable:</p> + + + <blockquote> + + +<p><strike><i>Single path type which can at runtime accept narrow or wide character +pathnames.</i> Although certainly interesting, and possibly superior, such a +design would not interoperate well with the current Standard Library's +compile-time typed <code>basic_string</code>. A new runtime polymorphic string +class would be the best place to experiment with this concept, not a path class.</strike></p> + + + </blockquote> + + + <h2><a name="TODO">TODO</a></h2> + <ul> + <li>Apply more C++0X features. Boost.Filesystem needs to implement these to verify their + application is correct.</li> + <li>Boost.Filesystem needs to implement <code>char16_t</code> and <code>char32_t</code> support to verify the + specification for these is correct.</li> + <li>Replace path inserter and extractor <i>Effects</i> with prose, since the + current wording relies on + <code>boost::io::quoted</code></span>.</li> + <li>The Boost implementation has more class path non-member relational + functions that shown in the docs, and the specific set of relational + functions varies between Windows and POSIX. Figure out what's happening and + document it.</li> + <li><code><a href="#Source">Source</a></code> is not specified as actually + implemented. Expose <code>path_traits</code>?</li> + <li><i>Effects</i> for <code>copy</code> and <code>copy_directory</code> + need to be reviewed, revised, tested, peer reviewed.</li> + <li>Review changes to header <fstream>. Add semantics. Add section + names. Verify still in sync with WP.</li> + </ul> + + $endid + +$id wording_prefix= +<h2>Proposed Wording</h2> + +<p><span style="font-style: italic; background-color: rgb(224, 224, 224);"> +Gray-shaded italic text is commentary on the proposal. It is not to be added to +the TR.</span></p> +<p><span style="font-style: italic; background-color: #E0E0E0">Add the following +to the Technical Report's front matter:</span></p> +<p>The following standard contains provisions which, through reference in this +text, constitute provisions of this Technical Report. At the time of +publication, the editions indicated were valid. All standards are subject to +revision, and parties to agreements based on this Technical Report are +encouraged to investigate the possibility of applying the most recent editions +of the standard indicated below. Members of IEC and ISO maintain registers of +currently valid International Standards.</p> +<ul> + <li>ISO/IEC 9945:2003, <i>Portable Operating System Interface (POSIX<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1975.html#Footnote-1"><sup>1</sup></a>), + part 1 (Base Definitions) and part 2 (System Interfaces)</i>, both as + corrected by their respective 2004 Correction 1 documents.<p>[<i>Note:</i> + ISO/IEC 9945:2003 is also IEEE Std 1003.1-2001, and The Open Group Base + Specifications, Issue 6, and is also known as The Single Unix<font face="Times New Roman"><sup><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1975.html#Footnote-2">2</a></sup><i><b> + </b></i>Specification, Version 3. It is available from each of those + organizations, and may be read online or downloaded from + <a href="http://www.unix.org/single_unix_specification/"> + www.unix.org/single_unix_specification/</a> <i>-- end note</i>]</font></li> +</ul> +<p>ISO/IEC 9945:2003, with the indicated corrections, is hereinafter called <i> +POSIX</i>.</p> +<p><a name="Footnote-1">Footnote 1</a>: <i>POSIX</i>® is a registered trademark +of The IEEE.</p> +<p><a name="Footnote-2">Footnote 2</a>: <i>UNIX</i>® is a registered trademark +of The Open Group.</p> +<p><span style="font-style: italic; background-color: #E0E0E0">Add the following +to the Technical Report as a new Clause:</span></p> +<h2>Filesystem Library</h2> + +$endid + +$id wording_suffix= +<p><span style="font-style: italic; background-color: #E0E0E0">End of new +Clause.</span></p> +<p dir="ltr"><span style="font-style: italic; background-color: #E0E0E0">Modify <a name="File-streams">File streams</a> +[fstreams] as follows:</span></p> +<p><span style="font-style: italic; background-color: #E0E0E0">To class +basic_filebuf public members add:</span></p> +<blockquote> +<pre>basic_filebuf<charT,traits>* open(const path& p, std::ios_base::openmode mode);</pre> + +</blockquote> +<p><span style="font-style: italic; background-color: #E0E0E0">To class +basic_ifstream public members add:</span></p> + +<blockquote> +<pre>explicit basic_ifstream(const path& p, std::ios_base::openmode mode=std::ios_base::in)</pre> + +<pre>void open(const path& p, std::ios_base::openmode mode=std::ios_base::in);</pre> + +</blockquote> +<p><span style="font-style: italic; background-color: #E0E0E0">To class +basic_ofstream public members add:</span></p> + +<blockquote> + <pre>explicit basic_ofstream(const path& p, std::ios_base::openmode mode=std::ios_base::out);</pre> + <pre>void open(const path& p, std::ios_base::openmode mode=std::ios_base::out);</pre> +</blockquote> +<p><span style="font-style: italic; background-color: #E0E0E0">To class +basic_fstream public members add:</span></p> +<blockquote> + <pre>explicit basic_fstream(const path& p, + std::ios_base::openmode mode=std::ios_base::in | std::ios_base::out);</pre> + <pre>void open(const path& p, + std::ios_base::openmode mode=std::ios_base::in | std::ios_base::out);</pre> +</blockquote> +<p> + +<span style="font-style: italic; background-color: rgb(224, 224, 224);"> +End of proposed wording.</span> </p> +<hr> +<h2><a name="Issues-List">Issues List</a></h2> +<hr> +<h3>Issue 1: What is the appropriate namespace?</h3> +<h4>Discussion</h4> +<p>The proposal places the library in <code>namespace std::tr2::$SUBNAMESPACE;</code>. +Rationale for a sub-namespace is that the library uses several names that don't +seem appropriate for namespace <code>tr2</code> since full standardization would +then put the names into <code>std</code>. The function names <code>remove</code> +and <code>rename</code> are of particular concern because these functions differ +in behavior from current standard library functions with those names. It also +doesn't seem desirable to preempt names like <code>equivalent</code> and <code> +status</code>.</p> +<p>The Boost Filesystem library used <code>namespace boost::filesystem</code>, +but that always seemed a bit too long.</p> +<h4>Proposed resolution</h4> +<p>Status quo. Leave in <code>namespace std::tr2::$SUBNAMESPACE;</code>.</p> +<hr> +<h3>Issue 2: Excessive use of <code>const codecvt_type&</code> arguments</h3> +<h4>Discussion</h4> +<p>Users sometimes need to do path conversions that use something other than the +imbued codecvt facet. The need is particularly acute in multi-threaded +applications where changing the imbued facet would introduce a data race. That +said, providing an optional <code>const codecvt_type&</code> argument for every +function where the need might possibly arise is excessive because its use is so +rare and it adds considerable interface clutter.</p> +<h4>Proposed resolution</h4> +<p dir="ltr">Remove all existing class path <code>const codecvt_type&</code> +arguments.</p> +<p>Add an additional non-member function:</p> +<blockquote> + <pre>unspecified-iterator-type convert(<code>const path& p, const codecvt_type& codecvt</code>);</pre> + <p dir="ltr"><i>Returns: </i>An unspecified iterator type whose value type is + <code>path::value_type</code>. The returned iterator points to the beginning + of a sequence equivalent to <code>p.native()</code> with encoding as specified + by <code>codecvt</code>.</p> +</blockquote> +<hr> +<h3>Issue 3: Possible "implicit cast to native type"?</h3> +<h4>Discussion</h4> +<p>In Bloomington there was discussion of "implicit cast to implicit cast to +native OS type to inter operate with existing iostream library and native +functions instead of modifying fstream".</p> +<p>Beman comments: I wasn't in Bloomington and am not sure of the context of the +above. N3239 inadvertently included the Boost docs for <fstream> rather than +suggested <fstream> changes for TR2, and that may have caused some confusion. Or +maybe I'm just missing something from the wiki notes. Some further discussions +are needed to better define the issue.</p> +<h4>Proposed resolution</h4> +<hr> +<h3>Issue 4: Given move semantics, it is best not to return const strings.</h3> +<h4>Discussion</h4> +<p>The issue title pretty much says it all.</p> +<h4>Proposed resolution</h4> +<p>As part of the C++11 refinements to the interface, review returns of const +strings and change to plain strings where appropriate.</p> +<hr> +<h3>Issue 5: Is there a way to handle characters that are illegal for particular +OS?</h3> +<h4>Discussion</h4> +<p>Question raised by Pablo in Bloomington.</p> +<h4>Proposed resolution</h4> +<p>Beman suggests NAD, Future. I've done some work on this, including looking at +systems like OpenVMS that have an escape mechanism to handle otherwise +unrepresentable characters. There was a comment to that effect in N3239. I +believe it should be deferred to some future release since (1) it is complex +enough that I'd like to see actual implementation and use experience (presumably +via Boost), and (2) I can't recall a user ever requesting such a feature.</p> +<hr> +<h3>Issue 6: Could allocator support be class path?</h3> +<h4>Discussion</h4> +<p>Question raised by a committee member in private email.</p> +<p>Comment from Beman: How would allocator support work, given that class path +is not a template?</p> +<h4>Proposed resolution</h4> +<hr> +<p>$endid + +$id backmatter= +$endid </p> + +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/tutorial.html b/libs/filesystem/v3/doc/tutorial.html new file mode 100644 index 0000000000..f275cb60e6 --- /dev/null +++ b/libs/filesystem/v3/doc/tutorial.html @@ -0,0 +1,1128 @@ +<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 Tutorial</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 Tutorial</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">Filesystem Home</a> + <a href="release_history.html">Releases</a> + <a href="reference.html">Reference</a> + <a href="tutorial.html">Tutorial</a> + <a href="faq.htm">FAQ</a> + <a href="portability_guide.htm">Portability</a> + <a href="v3.html">V3 Intro</a> + <a href="v3_design.html">V3 Design</a> + <a href="deprecated.html">Deprecated</a> + </td> + </tr> +</table> +<p> + <a href="#Introduction">Introduction</a><br> + <a href="#Preliminaries">Preliminaries</a><br> + <a href="#Reporting-size">Reporting the size of a file - (tut1.cpp)</a><br> + <a href="#Using-status-queries">Using status queries to determine file existence and type - (tut2.cpp)</a><br> + <a href="#Directory-iteration">Directory iteration plus catching + exceptions - (tut3.cpp)</a><br> + <a href="#Using-path-decomposition">Using path decomposition, plus sorting results - (tut4.cpp)</a><br> + <a href="#Class-path-Constructors">Class path: Constructors, including + Unicode - (tut5.cpp)</a><br> + <a href="#Class-path-formats">Class path: Generic format vs. Native format</a><br> + <a href="#Class path-iterators-etc">Class path: Iterators, observers, composition, decomposition, and query - (path_info.cpp)</a><br> + <a href="#Error-reporting">Error reporting</a><br> +</p> +<h2><a name="Introduction">Introduction</a></h2> + +<p>This tutorial develops a little command line program to list information +about files and directories - essentially a much simplified version of the POSIX <code>ls</code> or Windows <code>dir</code> +commands. We'll start with the simplest possible version and progress to more +complex functionality. Along the way we'll digress to cover topics you'll need +to know about to understand Boost.Filesystem.</p> + +<p>Source code for each of the tutorial programs is available, and you +are encouraged to compile, test, and experiment with it. To conserve space, we won't +always show boilerplate code here, but the provided source is complete and +ready to build.</p> + +<h2><a name="Preliminaries">Preliminaries</a></h2> + +<p>Install the Boost distribution if you haven't already done so. See the +<a href="http://www.boost.org/more/getting_started/index.html">Boost Getting +Started</a> docs.</p> + +<p>This tutorial assumes you are going to compile and test the examples using +the provided scripts. That's highly recommended.</p> + +<blockquote> + +<p><b>If you are planning to compile and test the examples but not use the +scripts, make sure your build setup knows where to +locate or build the Boost library binaries.</b></p> + +</blockquote> +<p>Fire up your command line interpreter, and type the following commands:</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt"> + <pre>$ cd <i><b>boost-root</b></i>/libs/filesystem/example/test +$ ./setup +$ ./bld +$ ./tut1 +Usage: tut1 path</pre> + </td> + <td style="font-size: 10pt"> + <pre>>cd <i><b>boost-root</b></i>\libs\filesystem\example\test +>setup +>bld +>tut1 +Usage: tut1 path</pre> + </td> + </tr> + </table> + +<p>If the <code>tut1</code> command outputs "<code>Usage: tut1 path</code>", all +is well. A set of tutorial programs has been copied (by <code>setup</code>) to +<i><b><code>boost-root</code></b></i><code>/libs/filesystem/example/test</code> +and then built. You are encouraged to modify and experiment with them as the +tutorial progresses. Just invoke the <code>bld</code> script again to rebuild.</p> + +<p>If something didn't work right, here are troubleshooting suggestions:</p> + + <ul> + <li>The <code>bjam</code> program executable isn't being found. + Check your path environmental variable if it should have been found, + otherwise see + <a href="http://www.boost.org/more/getting_started/windows.html">Boost + Getting Started</a>.<br> + </li> + <li>Look at <code>bjam.log</code> to try to spot an indication of the + problem.</li> + </ul> + +<h2><a name="Reporting-size">Reporting the size of a file</a> - (<a href="../example/tut1.cpp">tut1.cpp</a>)</h2> + +<p>Let's get started. One of the simplest things we can do is report the size of +a file.</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"> + <pre><a href="../example/tut1.cpp">tut1.cpp</a></pre> + <blockquote style="font-size: 10pt"> + <pre>#include <iostream> +#include <boost/filesystem.hpp> +using namespace boost::filesystem; + +int main(int argc, char* argv[]) +{ + if (argc < 2) + { + std::cout << "Usage: tut1 path\n"; + return 1; + } + std::cout << argv[1] << " " << file_size(argv[1]) << '\n'; + return 0; +}</pre> + </blockquote> + </td> + </tr> +</table> + +<p>The Boost.Filesystem <code><a href="reference.html#file_size">file_size</a></code> +function returns a <code>uintmax_t</code> +containing the size of the file named by the argument. The declaration looks +like this:</p> + +<blockquote> + <pre><span style="background-color: #FFFFFF; ">uintmax_t</span> <a name="file_size">file_size</a>(const path& p);</pre> +</blockquote> +<p>For now, all you need to know is that class path has constructors that take +<code>const char *</code> and many other useful types. (If you can't wait to +find out more, skip ahead to the <a href="#Class-path-Constructors">class path</a> section of +the tutorial.)</p> +<p>Please take a minute to try out <code>tut1</code> on your system, using a +file that is known to exist, such as <code>tut1.cpp</code>. Here is what the +results look like on two different operating systems:</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt" valign="top"> + <pre>$ ./tut1 tut1.cpp +tut1.cpp 569</pre> + <pre>$ ls -l tut1.cpp +-rwxrwxrwx 1 root root 569 2010-02-01 07:31 tut1.cpp</pre> + </td> + <td style="font-size: 10pt" valign="top"> + <pre>>tut1 tut1.cpp +tut1.cpp 592 +>dir tut1.cpp +... +01/30/2010 10:47 AM 592 tut1.cpp +...</pre> + </td> + </tr> + </table> + +<p>So far, so good. The reported Linux and Windows sizes are different because +the Linux tests used <code>"\n"</code> line endings, while the Windows tests +used <code>"\r\n"</code> line endings.</p> + <p>Now try again, but give a path that doesn't exist:</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" + style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt" valign="top"> + <pre>$ ./tut1 foo +terminate called after throwing an instance of 'boost::exception_detail:: +clone_impl<boost::exception_detail::error_info_injector<boost:: +filesystem::filesystem_error> >' + what(): boost::filesystem::file_size: No such file or directory: "foo" +Aborted</pre> + </td> + <td style="font-size: 10pt" valign="top"> + <pre>>tut1 foo</pre> + <p><b><i>An exception is thrown; the exact form of the response depends on + Windows system options.</i></b></td> + </tr> + </table> + + <p>What happens? + There's no file named <code>foo</code> in the current directory, so an +exception is thrown.</p> + <p>Try this:</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt"> + <pre>$ ./tut1 . +terminate called after throwing an instance of 'boost::exception_detail:: +clone_impl<boost::exception_detail::error_info_injector<boost:: +filesystem::filesystem_error> >' + what(): boost::filesystem::file_size: Operation not permitted "." +Aborted</pre> + </td> + <td style="font-size: 10pt" valign="top"> + <pre>>tut1 .</pre> + <p><b><i>An exception is thrown; the exact form of the response depends on + Windows system options.</i></b></td> + </tr> + </table> + + <p>The current directory exists, but <code>file_size()</code> works on regular + files, not directories, so again, an exception is thrown.</p> + + <p>We'll deal with those situations in <code>tut2.cpp</code>.</p> + +<h2><a name="Using-status-queries">Using status queries to determine file existence and type</a> - (<a href="../example/tut2.cpp">tut2.cpp</a>)</h2> + +<p>Boost.Filesystem includes status query functions such as <code> +<a href="reference.html#exists-path">exists</a></code>, +<code><a href="reference.html#is_directory-path">is_directory</a></code>, and <code> +<a href="reference.html#is_regular_file-path">is_regular_file</a></code>. These return +<code>bool</code>'s, and will return <code>true</code> if the condition +described by their name is met. Otherwise they return <code>false</code>, +including when any element +of the path argument can't be found.</p> + +<p>tut2.cpp uses several of the status query functions to cope with non-existent +files and with different kinds of files:</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"> + <pre><a href="../example/tut2.cpp">tut2.cpp</a></pre> + <blockquote style="font-size: 10pt"> + <pre>int main(int argc, char* argv[]) +{ + <a href="reference.html#class-path">path</a> p (argv[1]); // p reads clearer than argv[1] in the following code + + if (<a href="reference.html#exists-path">exists</a>(p)) // does p actually exist? + { + if (<a href="reference.html#is_regular_file-path">is_regular_file</a>(p)) // is p a regular file? + cout << p << " size is " << <a href="reference.html#file_size">file_size</a>(p) << '\n'; + + else if (<a href="reference.html#is_directory-path">is_directory</a>(p)) // is p a directory? + cout << p << "is a directory\n"; + + else + cout << p << "exists, but is neither a regular file nor a directory\n"; + } + else + cout << p << "does not exist\n"; + + return 0; +}</pre> + </blockquote> + </td> + </tr> +</table> + +<p>Give it a try:</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt" valign="top"> + <pre>$ ./tut2 tut2.cpp +tut2 size is cpp 1037 +$ ./tut2 foo +foo does not exist +$ ./tut2 . +. is a directory</pre> + </td> + <td style="font-size: 10pt" valign="top"> + <pre>>tut2 tut2.cpp +tut2.cpp size is 1079 + +>tut2 foo +foo does not exist + +>tut2 . +. is a directory</pre> + </td> + </tr> + </table> + +<p>Although tut2 works OK in these tests, the output is less than satisfactory +for a directory. We'd typically like to see a list of the directory's contents. In <code>tut3.cpp</code> +we will see how to iterate over directories.</p> + +<p>But first, let's try one more test:</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt" valign="top"> + <pre>$ ls /home/jane/foo +ls: cannot access /home/jane/foo: Permission denied +$ ./tut2 /home/jane/foo +terminate called after throwing an instance of 'boost::exception_detail:: +clone_impl<boost::exception_detail::error_info_injector<boost:: +filesystem::filesystem_error> >' + what(): boost::filesystem::status: Permission denied: + "/home/jane/foo" +Aborted</pre> + </td> + <td style="font-size: 10pt" valign="top"> + <pre>>dir e:\ +The device is not ready. +>tut2 e:\</pre> + <p><b><i>An exception is thrown; the exact form of the response depends on + Windows system options.</i></b></td> + </tr> + </table> + +<p>On the Linux system, the test was being run from an account that did not have +permission to access <code>/home/jane/foo</code>. On the Windows system, <code> +e:</code> was a Compact Disc reader/writer that was not ready. End users +shouldn't have to interpret cryptic exceptions reports, so as we move on to <code>tut3.cpp</code> +we will increase the robustness of the code, too.</p> + +<h2><a name="Directory-iteration">Directory iteration</a> plus catching +exceptions - (<a href="../example/tut3.cpp">tut3.cpp</a>)</h2> + +<p>Boost.Filesystem's <code><a href="reference.html#directory_iterator"> +directory_iterator</a></code> class is just what we need here. It follows the +general pattern of the standard library's <code>istream_iterator</code>. Constructed from +a path, it iterates over the contents of the directory. A default constructed <code>directory_iterator</code> +acts as the end iterator.</p> + +<p>The value type of <code>directory_iterator</code> is <code> +<a href="reference.html#directory_entry">directory_entry</a></code>. A <code> +directory_entry</code> object contains a <code>path</code> and <code><a href="reference.html#file_status">file_status</a></code> +information. A <code> +directory_entry</code> object +can be used directly, but can also be passed to <code>path</code> arguments in function calls.</p> + +<p>The other need is increased robustness in the face of the many kinds of +errors that can affect file system operations. We could do that at the level of +each call to a Boost.Filesystem function (see <a href="#Error-reporting">Error +reporting</a>), but it is easier to supply an overall try/catch block.</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"> + <pre><a href="../example/tut3.cpp">tut3.cpp</a></pre> + <blockquote> + <pre>int main(int argc, char* argv[]) +{ + <a href="reference.html#class-path">path</a> p (argv[1]); // p reads clearer than argv[1] in the following code + + try + { + if (<a href="reference.html#exists-path">exists</a>(p)) // does p actually exist? + { + if (<a href="reference.html#is_regular_file-path">is_regular_file</a>(p)) // is p a regular file? + cout << p << " size is " << <a href="reference.html#file_size">file_size</a>(p) << '\n'; + + else if (<a href="reference.html#is_directory-path">is_directory</a>(p)) // is p a directory? + { + cout << p << " is a directory containing:\n"; + + copy(directory_iterator(p), directory_iterator(), // directory_iterator::value_type + ostream_iterator<directory_entry>(cout, "\n")); // is directory_entry, which is + // converted to a path by the + // path stream inserter + } + + else + cout << p << " exists, but is neither a regular file nor a directory\n"; + } + else + cout << p << " does not exist\n"; + } + + catch (const filesystem_error& ex) + { + cout << ex.what() << '\n'; + } + + return 0; +}</pre> + </blockquote> + </td> + </tr> +</table> + +<p>Give <code>tut3</code> a try, passing it a path to a directory as a command line argument. +Here is a run on a checkout of the Boost Subversion trunk, followed by a repeat +of the test cases that caused exceptions on Linux and Windows:</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt" valign="top"> + <pre>$ ./tut3 ~/boost/trunk +/home/beman/boost/trunk is a directory containing: + /home/beman/boost/trunk/tools + /home/beman/boost/trunk/boost-build.jam + /home/beman/boost/trunk/dist + /home/beman/boost/trunk/doc + /home/beman/boost/trunk/bootstrap.sh + /home/beman/boost/trunk/index.html + /home/beman/boost/trunk/bootstrap.bat + /home/beman/boost/trunk/boost.css + /home/beman/boost/trunk/INSTALL + /home/beman/boost/trunk/rst.css + /home/beman/boost/trunk/boost + /home/beman/boost/trunk/people + /home/beman/boost/trunk/wiki + /home/beman/boost/trunk/boost.png + /home/beman/boost/trunk/LICENSE_1_0.txt + /home/beman/boost/trunk/more + /home/beman/boost/trunk/Jamroot + /home/beman/boost/trunk/.svn + /home/beman/boost/trunk/libs + /home/beman/boost/trunk/index.htm + /home/beman/boost/trunk/status + /home/beman/boost/trunk/CMakeLists.txt</pre> + </td> + <td style="font-size: 10pt" valign="top"> + <pre>>tut3 c:\boost\trunk +c:\boost\trunk is a directory containing: + c:\boost\trunk\.svn + c:\boost\trunk\boost + c:\boost\trunk\boost-build.jam + c:\boost\trunk\boost.css + c:\boost\trunk\boost.png + c:\boost\trunk\bootstrap.bat + c:\boost\trunk\bootstrap.sh + c:\boost\trunk\CMakeLists.txt + c:\boost\trunk\dist + c:\boost\trunk\doc + c:\boost\trunk\index.htm + c:\boost\trunk\index.html + c:\boost\trunk\INSTALL + c:\boost\trunk\Jamroot + c:\boost\trunk\libs + c:\boost\trunk\LICENSE_1_0.txt + c:\boost\trunk\more + c:\boost\trunk\people + c:\boost\trunk\rst.css + c:\boost\trunk\status + c:\boost\trunk\tools + c:\boost\trunk\wiki + +>tut3 e:\ +boost::filesystem::status: The device is not ready: "e:\"</pre> + </td> + </tr> + </table> + +<p>Not bad, but we can make further improvements:</p> + + <ul> + <li>The listing would be much easier to read if only the filename was + displayed, rather than the full path.<br> + </li> + <li>The Linux listing isn't sorted. That's because the ordering of + directory iteration is unspecified. Ordering depends on the underlying + operating system API and file system specifics. So we need to sort the + results ourselves. </li> + </ul> + +<p>Move on to <code>tut4.cpp</code> to see how those changes play out!</p> + +<h2><a name="Using-path-decomposition">Using path decomposition, plus sorting results</a> - (<a href="../example/tut4.cpp">tut4.cpp</a>)</h2> + +<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"> + <pre><a href="../example/tut4.cpp">tut4.cpp</a></pre> + <blockquote style="font-size: 10pt"> + <pre>int main(int argc, char* argv[]) +{ + <a href="reference.html#class-path">path</a> p (argv[1]); // p reads clearer than argv[1] in the following code + + try + { + if (<a href="reference.html#exists-path">exists</a>(p)) // does p actually exist? + { + if (<a href="reference.html#is_regular_file-path">is_regular_file</a>(p)) // is p a regular file? + cout << p << " size is " << <a href="reference.html#file_size">file_size</a>(p) << '\n'; + + else if (<a href="reference.html#is_directory-path">is_directory</a>(p)) // is p a directory? + { + cout << p << " is a directory containing:\n"; + + typedef vector<path> vec; // store paths, + vec v; // so we can sort them later + + copy(directory_iterator(p), directory_iterator(), back_inserter(v)); + + sort(v.begin(), v.end()); // sort, since directory iteration + // is not ordered on some file systems + + for (vec::const_iterator it (v.begin()); it != v.end(); ++it) + { + cout << " " << *it << '\n'; + } + } + + else + cout << p << " exists, but is neither a regular file nor a directory\n"; + } + else + cout << p << " does not exist\n"; + } + + catch (const filesystem_error& ex) + { + cout << ex.what() << '\n'; + } + + return 0; +}</pre> + </blockquote> + </td> + </tr> +</table> + + <p>The key difference between <code>tut3.cpp</code> and <code>tut4.cpp</code> is + what happens in the directory iteration loop. We changed:</p> + <blockquote> + <pre>cout << " " << *it << '\n'; // *it returns a <a href="reference.html#Class-directory_entry">directory_entry</a>,</pre> + </blockquote> + <p>to:</p> + <blockquote> + <pre>path fn = it->path().filename(); // extract the filename from the path +v.push_back(fn); // push into vector for later sorting</pre> + </blockquote> + <p><code><a href="reference.html#directory_entry-observers">path()</a></code> + is a <code>directory_entry</code> observer function. <code> + <a href="reference.html#path-filename">filename()</a></code> is one of + several path decomposition functions. It extracts the filename portion (<code>"index.html"</code>) + from a path (<code>"/home/beman/boost/trunk/index.html"</code>). These decomposition functions are + more fully explored in the <a href="#Class path-iterators-etc">Path iterators, observers, + composition, decomposition and query</a> portion of this tutorial.</p> + <p>The above was written as two lines of code for clarity. It could have + been written more concisely as:</p> + <blockquote> + <pre>v.push_back(it->path().filename()); // we only care about the filename</pre> + </blockquote> + <p>Here is the output from a test of <code><a href="../example/tut4.cpp">tut4.cpp</a></code>:</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt"> + <pre>$ ./tut4 ~/boost/trunk +/home/beman/boost/trunk is a directory containing: + .svn + CMakeLists.txt + INSTALL + Jamroot + LICENSE_1_0.txt + boost + boost-build.jam + boost.css + boost.png + bootstrap.bat + bootstrap.sh + doc + index.htm + index.html + libs + more + people + rst.css + status + tools + wiki</pre> + </td> + <td style="font-size: 10pt"> + <pre>C:\v3d>tut4 c:\boost\trunk +c:\boost\trunk is a directory containing: + .svn + CMakeLists.txt + INSTALL + Jamroot + LICENSE_1_0.txt + boost + boost-build.jam + boost.css + boost.png + bootstrap.bat + bootstrap.sh + doc + index.htm + index.html + libs + more + people + rst.css + status + tools + wiki</pre> + </td> + </tr> + </table> + + <p>That completes the main portion of this tutorial. If you haven't already + worked through the <a href="#Class-path-Constructors">Class path</a> sections of this tutorial, dig into them now. + The <a href="#Error-reporting">Error reporting</a> section may also be of + interest, although it can be skipped unless you are deeply concerned about + error handling issues.</p> + +<hr> + +<h2> <a name="Class-path-Constructors">Class path: Constructors</a>, +including Unicode - (<a href="../example/tut5.cpp">tut5.cpp</a>)</h2> + +<p>Traditional C interfaces pass paths as <code>const char*</code> arguments. +C++ interfaces may add <code>const std::string&</code> overloads, but adding +overloads becomes untenable if wide characters, containers, and iterator ranges +need to be supported.</p> +<p>Passing paths as <code>const path&</code> arguments is far simpler, yet far +more flexible because class <code>path</code> itself is far more flexible:</p> +<ol> + <li>Class <code>path</code> supports multiple character types and encodings, including Unicode, to + ease internationalization.</li> + <li>Class <code>path</code> supports multiple source types, such as iterators for null terminated + sequences, iterator ranges, containers (including <code>std::basic_string</code>), + and <code><a href="reference.html#Class-directory_entry">directory_entry</a></code>'s, + so functions taking paths don't need to provide several overloads.</li> + <li>Class <code>path</code> supports both native and generic pathname formats, so programs can be + portable between operating systems yet use native formats where desirable.</li> + <li>Class <code>path</code> supplies a full set of iterators, observers, composition, + decomposition, and query functions, making pathname manipulations easy, + convenient, reliable, and portable.</li> +</ol> +<p>Here is how (1) and (2) work. Class path constructors, +assignments, and appends have member templates for sources. For example, here +are the constructors that take sources:</p> + +<blockquote style="font-size: 10pt"> + <pre>template <class <a href="reference.html#Source">Source</a>> + path(Source const& source);</pre> + <pre>template <class InputIterator> + path(InputIterator begin, InputIterator end);</pre> +</blockquote> +<p>Let's look at a little program that shows how comfortable class <code>path</code> is with +both narrow and wide characters in C-style strings, C++ strings, and via C++ +iterators:</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"> + <pre><a href="../example/tut4.cpp">tut5.cpp</a></pre> + <blockquote> + <pre>#include <boost/filesystem.hpp> +#include <string> +#include <list> +namespace fs = boost::filesystem; + +int main() +{ + // \u263A is "Unicode WHITE SMILING FACE = have a nice day!" + std::string narrow_string ("smile2"); + std::wstring wide_string (L"smile2\u263A"); + std::list<char> narrow_list; + narrow_list.push_back('s'); + narrow_list.push_back('m'); + narrow_list.push_back('i'); + narrow_list.push_back('l'); + narrow_list.push_back('e'); + narrow_list.push_back('3'); + std::list<wchar_t> wide_list; + wide_list.push_back(L's'); + wide_list.push_back(L'm'); + wide_list.push_back(L'i'); + wide_list.push_back(L'l'); + wide_list.push_back(L'e'); + wide_list.push_back(L'3'); + wide_list.push_back(L'\u263A'); + + { fs::ofstream f("smile"); } + { fs::ofstream f(L"smile\u263A"); } + { fs::ofstream f(narrow_string); } + { fs::ofstream f(wide_string); } + { fs::ofstream f(narrow_list); } + { fs::ofstream f(wide_list); } + narrow_list.pop_back(); + narrow_list.push_back('4'); + wide_list.pop_back(); + wide_list.pop_back(); + wide_list.push_back(L'4'); + wide_list.push_back(L'\u263A'); + { fs::ofstream f(fs::path(narrow_list.begin(), narrow_list.end())); } + { fs::ofstream f(fs::path(wide_list.begin(), wide_list.end())); } + + return 0; +}</pre> + </blockquote> + </td> + </tr> +</table> + +<p>Testing <code>tut5</code>:</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt" valign="top"> + <pre>$ ./tut5 +$ ls smile* +smile smile☺ smile2 smile2☺ smile3 smile3☺ smile4 smile4☺</pre> + </td> + <td style="font-size: 10pt" valign="top"> + <pre>>tut5 +>dir /b smile* +smile +smile2 +smile2☺ +smile3 +smile3☺ +smile4 +smile4☺ +smile☺</pre> + </td> + </tr> + </table> + +<p>Note that the exact appearance of the smiling face will depend on the font, +font size, and other settings for your command line window. The above tests were +run with out-of-the-box Ubuntu 9.10 and Windows 7, US Edition. If you don't get +the above results, take a look at the <code><i>boost-root</i>/libs/filesystem/example/test</code> +directory with your system's GUI file browser, such as Linux Nautilus, Mac OS X +Finder, or Windows Explorer. These tend to be more comfortable with +international character sets than command line interpreters.</p> + + <p>Class <code>path</code> takes care of whatever character type or encoding + conversions are required by the particular operating system. Thus as <code> + tut5</code> demonstrates, it's no problem to pass a wide character string to a + Boost.Filesystem operational function even if the underlying operating system + uses narrow characters, and visa versa. And the same applies to user supplied + functions that take <code>const path&</code> arguments.</p> + + <p>Class <code>path</code> also provides path syntax that is portable across operating systems, + element iterators, and observer, composition, decomposition, and query + functions to manipulate the elements of a path. The next section of this + tutorial deals with path syntax.</p> + + <hr> + +<h2><a name="Class-path-formats">Class path: Generic format vs. Native format</a></h2> + +<p dir="ltr">Class <code>path</code> deals with two different pathname +formats - generic format and native format. For POSIX-like +file systems, these formats are the same. But for users of Windows and +other non-POSIX file systems, the distinction is important. Even +programmers writing for POSIX-like systems need to understand the distinction if +they want their code to be portable to non-POSIX systems.</p> + +<p dir="ltr">The <b>generic format</b> is the familiar <code>/my_directory/my_file.txt</code> format used by POSIX-like +operating systems such as the Unix variants, Linux, and Mac OS X. Windows also +recognizes the generic format, and it is the basis for the familiar Internet URL +format. The directory +separator character is always one or more slash characters.</p> + +<p dir="ltr">The <b>native format</b> is the format as defined by the particular +operating system. For Windows, either the slash or the backslash can be used as +the directory separator character, so <code>/my_directory\my_file.txt</code> +would work fine. Of course, if you write that in a C++ string literal, it +becomes <code>"/my_directory\\my_file.txt"</code>.</p> + +<p dir="ltr">If a drive specifier or a backslash appears +in a pathname on a Windows system, it is always treated as the native format.</p> + +<p dir="ltr">Class <code>path</code> has observer functions that allow you to +obtain the string representation of a path object in either the native format +or the generic format. See the <a href="#Class path-iterators-etc">next section</a> +for how that plays out.</p> + + <p>The distinction between generic format and native format is important when + communicating with native C-style API's and with users. Both tend to expect + paths in the native format and may be confused by the generic format. The generic + format is great, however, for writing portable programs that work regardless + of operating system.</p> + + <p>The next section covers class <code>path</code> observers, composition, + decomposition, query, and iteration over the elements of a path.</p> + + <hr> + +<h2><a name="Class path-iterators-etc">Class path: Iterators, observers, composition, decomposition, and query</a> +- (<a href="../example/path_info.cpp">path_info.cpp</a>)</h2> + +<p>The <code><a href="../example/path_info.cpp">path_info.cpp</a></code> program is handy for learning how class <code>path</code> +iterators, +observers, composition, decomposition, and query functions work on your system. +If it hasn't already already been built on your system, please build it now. Run +the examples below on your system, and try some different path arguments as we +go along.</p> + +<p> <code>path_info</code> produces several dozen output lines every time it's +invoked. We will only show the output lines we are interested in at each step.</p> + +<p>First we'll look at iteration over the elements of a path, and then use +iteration to illustrate the difference between generic and native format paths.</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt"> + <pre>$ ./path_info /foo/bar/baa.txt +... +elements: + / + foo + bar + baa.txt</pre> + </td> + <td style="font-size: 10pt"> + <pre>>path_info /foo/bar/baa.txt +... +elements: + / + foo + bar + baa.txt</pre> + </td> + </tr> + </table> + +<p>Thus on both POSIX and Windows based systems the path <code>"/foo/bar/baa.txt"</code> +is seen as having four elements.</p> + +<p>Here is the code that produced the above listing:</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"> + <blockquote style="font-size: 10pt"> + <pre>cout << "\nelements:\n"; + +for (path::iterator it = p.begin(); it != p.end(); ++it) + cout << " " << *it << '\n';</pre> + </blockquote> + </td> + </tr> +</table> +<p><code>path::iterator::value_type</code> is <code>path::string_type</code>, +and iteration treats <code>path</code> as a container of filenames.</p> + +<p dir="ltr">Let's look at some of the output from a slightly different +example:</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt"> + <pre>$ ./path_info /foo/bar/baa.txt + +composed path: + cout << -------------: /foo/bar/baa.txt + preferred()----------: /foo/bar/baa.txt +... +observers, native format: + native()-------------: /foo/bar/baa.txt + c_str()--------------: /foo/bar/baa.txt + string()-------------: /foo/bar/baa.txt + wstring()------------: /foo/bar/baa.txt + +observers, generic format: + generic_string()-----: /foo/bar/baa.txt + generic_wstring()----: /foo/bar/baa.txt</pre> + </td> + <td style="font-size: 10pt"> + <pre>>path_info /foo/bar\baa.txt + +composed path: + cout << -------------: /foo/bar/baa.txt + preferred()----------: \foo\bar\baa.txt +... +observers, native format: + native()-------------: /foo/bar\baa.txt + c_str()--------------: /foo/bar\baa.txt + string()-------------: /foo/bar\baa.txt + wstring()------------: /foo/bar\baa.txt + +observers, generic format: + generic_string()-----: /foo/bar/baa.txt + generic_wstring()----: /foo/bar/baa.txt</pre> + </td> + </tr> + </table> + +<p dir="ltr">Native format observers should be used when interacting with the +operating system or with users; that's what they expect.</p> + +<p dir="ltr">Generic format observers should be used when the results need to be +portable and uniform regardless of the operating system.</p> + +<p dir="ltr"><code>path</code> objects always hold pathnames in the native +format, but otherwise leave them unchanged from their source. The +<a href="reference.html#preferred">preferred()</a> function will convert to the +preferred form, if the native format has several forms. Thus on Windows, it will +convert slashes to backslashes.</p> + +<p dir="ltr">Let's move on to decomposition and query functions:</p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt"> + <pre>$ ./path_info /foo/bar/baa.txt +... +decomposition: + root_name()----------: + root_directory()-----: / + root_path()----------: / + relative_path()------: foo/bar/baa.txt + parent_path()--------: /foo/bar + filename()-----------: baa.txt + stem()---------------: baa + extension()----------: .txt + +query: + empty()--------------: false + <span style="background-color: #FFFF00">is_absolute</span><span style="background-color: #FFFF00">()--------: true</span> + has_root_name()------: false + has_root_directory()-: true + has_root_path()------: true + has_relative_path()--: true + has_parent_path()----: true + has_filename()-------: true + has_stem()-----------: true + has_extension()------: true</pre> + </td> + <td style="font-size: 10pt"> + <pre>>path_info /foo/bar/baa.txt +... +decomposition: + root_name()----------: + root_directory()-----: / + root_path()----------: / + relative_path()------: foo/bar/baa.txt + parent_path()--------: /foo/bar + filename()-----------: baa.txt + stem()---------------: baa + extension()----------: .txt + +query: + empty()--------------: false + <span style="background-color: #FFFF00">is_absolute</span><span style="background-color: #FFFF00">()--------: false</span> + has_root_name()------: false + has_root_directory()-: true + has_root_path()------: true + has_relative_path()--: true + has_parent_path()----: true + has_filename()-------: true + has_stem()-----------: true + has_extension()------: true</pre> + </td> + </tr> + </table> + +<p dir="ltr">These are pretty self-evident, but do note the difference in the +result of <code>is_absolute()</code> between Linux and Windows. Because there is +no root name (i.e. drive specifier or network name), a lone slash (or backslash) +is a relative path on Windows. </p> + +<p dir="ltr">On to composition!</p> + +<p>Class <code>path</code> uses <code>/</code> and <code>/=</code> operators to +append elements. That's a reminder +that these operations append the operating system's preferred directory +separator if needed. The preferred +directory separator is a slash on POSIX-like systems, and a backslash on +Windows-like systems.</p> + +<p><a href="../example/path_info.cpp"><code>path_info.cpp</code></a> +composes a path by appending each of the command line elements to an initially +empty path:</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"> + <blockquote> + <pre>path p; // compose a path from the command line arguments + +for (; argc > 1; --argc, ++argv) + p /= argv[1]; + +cout << "\ncomposed path:\n"; +cout << " cout << -------------: " << p << "\n"; +cout << " preferred()----------: " << p.preferred() << "\n";</pre> + </blockquote> + </td> + </tr> +</table> + +<p>Let's give this code a try: </p> + + <table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%"> + <tr> + <td align="center" width="50%" style="font-size: 10pt"><i><b>Ubuntu Linux </b></i></td> + <td align="center" style="font-size: 10pt"><i><b>Microsoft Windows</b></i></td> + </tr> + <tr> + <td width="50%" style="font-size: 10pt"> + <pre>$ ./path_info / foo/bar baa.txt + +composed path: + cout << -------------: /foo/bar/baa.txt + preferred()----------: /foo/bar/baa.txt</pre> + </td> + <td style="font-size: 10pt"> + <pre>>path_info / foo/bar baa.txt + +composed path: + cout << -------------: /foo/bar\baa.txt + preferred()----------: \foo\bar\baa.txt</pre> + </td> + </tr> + </table> + + <p> </p> + + <hr> + + <h2><a name="Error-reporting">Error reporting</a></h2> + + <p>The Boost.Filesystem <code>file_size</code> function has two overloads:</p> + + <blockquote> + <pre><span style="background-color: #FFFFFF; ">uintmax_t</span> <a name="file_size">file_size</a>(const path& p); +<span style="background-color: #FFFFFF; ">uintmax_t</span> <a name="file_size2">file_size</a>(const path& p, system::error_code& ec);</pre> +</blockquote> +<p>The only significant difference between the two is how they report errors.</p> +<p>The + first signature will throw exceptions to report errors. A <code> +<a href="reference.html#Class-filesystem_error">filesystem_error</a></code> exception will be thrown +on an + operational error. <code>filesystem_error</code> is derived from <code>std::runtime_error</code>. +It has a + member function to obtain the <code> +<a href="../../../system/doc/reference.html#Class-error_code">error_code</a></code> reported by the source + of the error. It also has member functions to obtain the path or paths that caused + the error.</p> + + <blockquote> + + <p><b>Motivation for the second signature:</b> Throwing exceptions on errors was the entire error reporting story for the earliest versions of + Boost.Filesystem, and indeed throwing exceptions on errors works very well for + many applications. But user reports trickled in that some code became so + littered with try and catch blocks as to be unreadable and unmaintainable. In + some applications I/O errors aren't exceptional, and that's the use case for + the second signature.</p> + + </blockquote> + + <p>Functions with a <code>system::error_code&</code> argument set that + argument to report operational error status, and so do not throw exceptions when I/O + related errors occur. For a full explanation, see + <a href="reference.html#Error-reporting">Error reporting</a> in the reference + documentation. </p> + +<hr> +<p>© Copyright Beman Dawes 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 -->20 February 2011<!--webbot bot="Timestamp" endspan i-checksum="40667" --></p> + +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/v3.html b/libs/filesystem/v3/doc/v3.html new file mode 100644 index 0000000000..83dafbfab5 --- /dev/null +++ b/libs/filesystem/v3/doc/v3.html @@ -0,0 +1,151 @@ +<html> + +<head> +<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 V3 Intro</title> +<link rel="stylesheet" type="text/css" href="../../../../doc/src/minimal.css"> + +<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 + Version 3<br> + Introduction</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">Filesystem Home</a> + <a href="release_history.html">Releases</a> + <a href="reference.html">Reference</a> + <a href="tutorial.html">Tutorial</a> + <a href="faq.htm">FAQ</a> + <a href="portability_guide.htm">Portability</a> + <a href="v3.html">V3 Intro</a> + <a href="v3_design.html">V3 Design</a> + <a href="deprecated.html">Deprecated</a> + </td> + </tr> +</table> + +<h1>Boost Filesystem Version 3</h1> + +<p>Version 3 is a major revision of the Boost Filesystem library. Important +changes include:</p> + +<ul> + <li>A single class <code>path</code> handles all aspects of + internationalization, replacing the previous template and its <code>path</code> + and <code>wpath</code> instantiations. Character types <code>char</code>, + <code>wchar_t</code>, <code>char16_t</code>, and <code>char32_t</code> are + supported. This is a major simplification of the path abstraction, + particularly for functions that take path arguments.<br> + </li> + <li>New <code>class path</code> members include:<br> + <ul> + <li><code><a href="reference.html#path-has_stem">has_stem</a>()</code></li> + <li><code><a href="reference.html#path-has_extension">has_extension</a>()</code></li> + <li><code><a href="reference.html#path-is_absolute">is_absolute</a>()</code>. This renames <code>is_complete()</code>, which + is now deprecated.</li> + <li><code><a href="reference.html#path-is_relative">is_relative</a>()</code></li> + <li><code><a href="reference.html#path-make_preferred">make_preferred</a>()<br> + </code></li> +</ul> + + </li> + <li>New or improved operations functions include:<br> + <ul> + <li><code><a href="reference.html#absolute">absolute</a>()</code>. This replaces the operations function <code> + complete()</code>, which is now deprecated. Semantics are now provided for a + Windows corner case where the <code>base</code> argument was not an absolute + path. Previously this resulted in an exception being thrown.</li> + <li><code><a href="reference.html#create_symlink">create_symlink</a>()</code> now supported on both POSIX and Windows.</li> + <li><code><a href="reference.html#read_symlink">read_symlink</a>()</code> function added. Supported on both POSIX and + Windows. Used to read the contents of a symlink itself.</li> + <li><code><a href="reference.html#resize_file">resize_file</a>()</code> function added. Supported on both POSIX and + Windows. Used to shrink or grow a regular file.</li> + <li><code><a href="reference.html#unique_path">unique_path</a>()</code> function added. Supported on both POSIX and + Windows. Used to generate a secure temporary pathname.<br> + </li> + </ul> + </li> + <li>Support for error reporting via <code>error_code</code> is now uniform + throughout the operations functions.<br> + </li> + <li>Documentation has been reworked, including re-writes of major portions.<br> + </li> + <li>A new <a href="tutorial.html">Tutorial</a> provides a hopefully much + gentler and more complete introduction for new users. Current users might want + to review the <a href="tutorial.html">three sections related to class path</a>.</li> +</ul> + +<h2>Deprecated names and other features</h2> + +<p>See the <a href="deprecated.html">Deprecated Features page</a> for transition +aids that allow much existing code to compile without change using Version 3.</p> + +<h2>Breaking changes</h2> + +<p>To ease the transition, Versions 2 and 3 will both be included in the next +several Boost releases. Version 2 will be the default version for one release +cycle, and then Version 3 will become the default version.</p> +<h3>Class <code>path</code></h3> +<ul> + <li>Class template <code>basic_path</code> and its specializations are + replaced by a single <code>class path</code>. Thus any code, such as + overloaded functions, that depends on <code>path</code> and <code>wpath</code> + being two distinct types will fail to compile and must be restructured. + Restructuring may be as simple as removing one of the overloads, but also + might require more complex redesign.<br> + </li> + <li>Certain functions now return <code>path</code> objects rather than <code> + string or wstring</code> objects:<ul> + <li><code>root_name()</code></li> + <li><code>root_directory()</code></li> + <li><code>filename()</code></li> + <li><code>stem()</code></li> + <li><code>extension()</code></li> + </ul> + <p>Not all uses will fail; if the function is being called in a context that + accepts a <code>path</code>, all is well. If the result is being used in a + context requiring a <code>std::string</code> or <code>std::wstring</code>, + then <code>.string()</code> or <code>.wstring()</code> respectively must be + appended to the function call.<br> + </li> + <li> <code>path::iterator::value_type</code> and <code> + path::const_iterator::value_type</code> is <code>path</code> rather than <code> + basic_string</code>.</li> +</ul> +<h3>Compiler support</h3> +<ul> + <li>Compilers and standard libraries that do not fully support wide characters + and wide character strings (<code>std::wstring</code>) are no longer + supported.<br> + </li> + <li>Cygwin versions prior to 1.7 are no longer supported because they lack + wide string support. Cygwin now compiles only for the Windows API and path + syntax.<br> + </li> + <li>MinGW versions not supporting wide strings are no longer supported.<br> + </li> + <li>Microsoft VC++ 7.1 and earlier are no longer supported.</li> +</ul> + +<hr> +<p>© Copyright Beman Dawes, 2009</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 -->20 February 2011<!--webbot bot="Timestamp" endspan i-checksum="40667" --></p> + +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/doc/v3_design.html b/libs/filesystem/v3/doc/v3_design.html new file mode 100644 index 0000000000..c5204fff85 --- /dev/null +++ b/libs/filesystem/v3/doc/v3_design.html @@ -0,0 +1,192 @@ +<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 V3 Design</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> +<a href="../../../../index.htm"> +<img src="../../../../boost.png" alt="boost.png (6897 bytes)" align="middle" border="0" width="300" height="86"></a></td> + <td align="middle"> + <font size="7">Filesystem Version 3<br> + Design</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">Filesystem Home</a> + <a href="release_history.html">Releases</a> + <a href="reference.html">Reference</a> + <a href="tutorial.html">Tutorial</a> + <a href="faq.htm">FAQ</a> + <a href="portability_guide.htm">Portability</a> + <a href="v3.html">V3 Intro</a> + <a href="v3_design.html">V3 Design</a> + <a href="deprecated.html">Deprecated</a> + </td> + </tr> +</table> + +<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" align="right"> + <tr> + <td width="100%" bgcolor="#D7EEFF" align="center"> + <i><b>Contents</b></i></td> + </tr> + <tr> + <td width="100%" bgcolor="#E8F5FF"> + <a href="#Introduction">Introduction</a><br> + <a href="#Problem">Problem</a><br> + <a href="#Solution">Solution</a><br> + <a href="#Details">Details</a><br> + <a href="#Other-changes">Other changes</a><br> + <a href="#Acknowledgements">Acknowledgements</a></td> + </tr> + </table> + +<p><b>Caution:</b> This page documents thinking early in the V3 development +process, and is intended to serve historical purposes. It is not updated to +reflect the current state of the library.</p> + +<h2><a name="Introduction">Introduction</a></h2> + +<p>During the review of Boost.Filesystem.V2 (Internationalization), Peter Dimov +suggested that the<code> basic_path</code> class template was unwieldy, and that a single +path type that accommodated multiple character types and encodings would be more +flexible. Although I wasn't willing to stop development at that time to +explore how this idea might be implemented, or to break from the pattern for +Internationalization used the C++ standard library, I've often thought about +Peter's suggestion. With the advent of C++0x <code>char16_t</code> and <code>char32_t</code> character +types, the <code>basic_path</code> class template approach becomes even more unwieldy, so it +is time to revisit the problem in light of Peter's suggestion.</p> + +<h2><b><a name="Problem">Problem</a></b></h2> + +<p>With Filesystem.V2, a path argument to a user defined function that is to +accommodate multiple character types and encodings must be written as a +template. Do-the-right-thing overloads or template metaprogramming must be +employed to allow arguments to be written as string literals. Here's what it +looks like:</p> + +<blockquote> + <pre>template<class Path> +void foo( const Path & p );</pre> + <pre>inline void foo( const path & p ) +{ + return foo<path>( p ); +} +inline void foo( const wpath & p ) +{ + return foo<wpath>( p ); +}</pre> +</blockquote> +<p>That's really ugly for such a simple need, and there would be a combinatorial +explosion if the function took multiple Path arguments and each could be either +narrow or wide. It gets even worse if the C++0x <code>char16_t</code> and <code> +char32_t</code> types are to be supported.</p> + +<h2><a name="Solution">Solution</a></h2> + +<p>Overview:</p> + +<ul> + <li>A single, non-template, <code>class path</code>.</li> + <li>Each member function is a template accommodating the various + applicable character types, including user-defined character types.</li> + <li>Hold the path internally in a string of the type used by the operating + system API; <code>std::string</code> for POSIX, <code>std::wstring</code> for Windows.</li> +</ul> + +<p>The signatures presented in <a href="#Problem">Problem</a> collapse to +simply:</p> +<blockquote> + <pre>void foo( const path & p );</pre> +</blockquote> + +<p>That's a signification reduction in code complexity. Specification becomes +simpler, too. I believe it will be far easier to teach, and result in much more +flexible user code.</p> + +<p>Other benefits:</p> +<ul> + <li>All the polymorphism still occurs at compile time.</li> + <li>Efficiency is increased, in that conversions of the encoding, if required, + only occur once at the time of creation, not each time the path is used.</li> + <li>The size of the implementation code drops approximately in half and + becomes much more readable.</li> +</ul> + <p>Possible problems:</p> +<ul> + <li>The combination of member function templates and implicit constructors can + result in unclear error messages when the user makes simple commonplace coding + errors. This should be much less of a problem with C++ concepts, but in the + meantime work continues to restrict over aggressive templates via enable_if/disable_if.</li> +</ul> + <h2><a name="Details">Details</a></h2> + +<table border="1" cellpadding="4" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> + <tr> + <td width="33%" colspan="3"> + <p align="center"><b><i>Encoding </i></b><i><b>Conversions</b></i></td> + </tr> + <tr> + <td width="33%"> + <p align="center"><i><b>Host system</b></i></td> + <td width="33%"> + <p align="center"><i><b>char string path arguments</b></i></td> + <td width="34%"> + <p align="center"><i><b>wide string path arguments</b></i></td> + </tr> + <tr> + <td width="33%">Systems with <code>char</code> as the native API path character type (i.e. + POSIX-like systems)</td> + <td width="33%">No conversion.</td> + <td width="34%">Conversion occurs, performed by the current path locale's + <code>codecvt</code> facet.</td> + </tr> + <tr> + <td width="33%">Systems with <code>wchar_t</code> as the native API path character type + (i.e. Windows-like systems).</td> + <td width="33%">Conversion occurs, performed by the current path locale's + <code>codecvt</code> facet.</td> + <td width="34%">No conversion.</td> + </tr> +</table> + +<p>When a class path function argument type matches the the operating system's +API argument type for paths, no conversion is performed rather than conversion +to a specified encoding such as one of the Unicode encodings. This avoids +unintended consequences, etc.</p> + +<h2><a name="Other-changes">Other changes</a></h2> + +<p><b>Uniform hybrid error handling: </b>The hybrid error handling idiom has +been consistently applied to all applicable functions.</p> + +<h2><a name="Acknowledgements">Acknowledgements</a></h2> + +<p>Peter Dimov suggested the idea of a single path class that could cope with +multiple character types and encodings. Walter Landry contributed both the design and implementation of the copy_any, +copy_directory, copy_symlink, and read_symlink functions.</p> + +<hr> +<p>Revised +<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->20 February, 2011<!--webbot bot="Timestamp" endspan i-checksum="40524" --></p> + +<p>© Copyright Beman Dawes, 2008</p> +<p> Use, modification, and distribution are subject to 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> + +</body> + +</html>
\ No newline at end of file diff --git a/libs/filesystem/v3/example/Jamfile.v2 b/libs/filesystem/v3/example/Jamfile.v2 new file mode 100644 index 0000000000..2d2ea27fcd --- /dev/null +++ b/libs/filesystem/v3/example/Jamfile.v2 @@ -0,0 +1,27 @@ +# Boost Filesystem Library Example Jamfile + +# (C) Copyright Vladimir Prus 2003 + +# Distributed under the Boost Software License, Version 1.0. +# See www.boost.org/LICENSE_1_0.txt + +# Library home page: http://www.boost.org/libs/filesystem + +project + : requirements + <library>/boost/filesystem//boost_filesystem + <library>/boost/system//boost_system + <toolset>msvc:<asynch-exceptions>on + <link>static + ; + +exe tut0 : tut0.cpp ; +exe tut1 : tut1.cpp ; +exe tut2 : tut2.cpp ; +exe tut3 : tut3.cpp ; +exe tut4 : tut4.cpp ; +exe tut5 : tut5.cpp ; +exe path_info : path_info.cpp ; +exe file_status : file_status.cpp ; + +install bin : file_status ; #invoke via "bjam", not "bjam install" diff --git a/libs/filesystem/v3/example/error_demo.cpp b/libs/filesystem/v3/example/error_demo.cpp new file mode 100644 index 0000000000..ce16b3bc47 --- /dev/null +++ b/libs/filesystem/v3/example/error_demo.cpp @@ -0,0 +1,185 @@ +// error_demo.cpp --------------------------------------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// +// // +// The purpose of this program is to demonstrate how error reporting works. // +// // +//--------------------------------------------------------------------------------------// + +#include <boost/filesystem.hpp> +#include <boost/system/system_error.hpp> +#include <iostream> + +using std::cout; +using boost::filesystem::path; +using boost::filesystem::filesystem_error; +using boost::system::error_code; +using boost::system::system_error; +namespace fs = boost::filesystem; + +namespace +{ + void report_system_error(const system_error& ex) + { + cout << " threw system_error:\n" + << " ex.code().value() is " << ex.code().value() << '\n' + << " ex.code().category().name() is " << ex.code().category().name() << '\n' + << " ex.what() is " << ex.what() << '\n' + ; + } + + void report_filesystem_error(const system_error& ex) + { + cout << " threw filesystem_error exception:\n" + << " ex.code().value() is " << ex.code().value() << '\n' + << " ex.code().category().name() is " << ex.code().category().name() << '\n' + << " ex.what() is " << ex.what() << '\n' + ; + } + + void report_status(fs::file_status s) + { + cout << " file_status::type() is "; + switch (s.type()) + { + case fs::status_error: + cout << "status_error\n"; break; + case fs::file_not_found: + cout << "file_not_found\n"; break; + case fs::regular_file: + cout << "regular_file\n"; break; + case fs::directory_file: + cout << "directory_file\n"; break; + case fs::symlink_file: + cout << "symlink_file\n"; break; + case fs::block_file: + cout << "block_file\n"; break; + case fs::character_file: + cout << "character_file\n"; break; + case fs::fifo_file: + cout << "fifo_file\n"; break; + case fs::socket_file: + cout << "socket_file\n"; break; + case fs::type_unknown: + cout << "type_unknown\n"; break; + default: + cout << "not a valid enumeration constant\n"; + } + } + + void report_error_code(const error_code& ec) + { + cout << " ec:\n" + << " value() is " << ec.value() << '\n' + << " category().name() is " << ec.category().name() << '\n' + << " message() is " << ec.message() << '\n' + ; + } + + bool threw_exception; + +} + +int main(int argc, char* argv[]) +{ + if (argc < 2) + { + cout << "Usage: error_demo path\n"; + return 1; + } + + error_code ec; + + //// construct path - no error_code + + //try { path p1(argv[1]); } + //catch (const system_error& ex) + //{ + // cout << "construct path without error_code"; + // report_system_error(ex); + //} + + //// construct path - with error_code + + path p (argv[1]); + + fs::file_status s; + bool b (false); + fs::directory_iterator di; + + // get status - no error_code + + cout << "\nstatus(\"" << p.string() << "\");\n"; + threw_exception = false; + + try { s = fs::status(p); } + catch (const system_error& ex) + { + report_filesystem_error(ex); + threw_exception = true; + } + if (!threw_exception) + cout << " Did not throw exception\n"; + report_status(s); + + // get status - with error_code + + cout << "\nstatus(\"" << p.string() << "\", ec);\n"; + s = fs::status(p, ec); + report_status(s); + report_error_code(ec); + + // query existence - no error_code + + cout << "\nexists(\"" << p.string() << "\");\n"; + threw_exception = false; + + try { b = fs::exists(p); } + catch (const system_error& ex) + { + report_filesystem_error(ex); + threw_exception = true; + } + if (!threw_exception) + { + cout << " Did not throw exception\n" + << " Returns: " << (b ? "true" : "false") << '\n'; + } + + // query existence - with error_code + + // directory_iterator - no error_code + + cout << "\ndirectory_iterator(\"" << p.string() << "\");\n"; + threw_exception = false; + + try { di = fs::directory_iterator(p); } + catch (const system_error& ex) + { + report_filesystem_error(ex); + threw_exception = true; + } + if (!threw_exception) + { + cout << " Did not throw exception\n" + << (di == fs::directory_iterator() ? " Equal" : " Not equal") + << " to the end iterator\n"; + } + + // directory_iterator - with error_code + + cout << "\ndirectory_iterator(\"" << p.string() << "\", ec);\n"; + di = fs::directory_iterator(p, ec); + cout << (di == fs::directory_iterator() ? " Equal" : " Not equal") + << " to the end iterator\n"; + report_error_code(ec); + + return 0; +} diff --git a/libs/filesystem/v3/example/file_size.cpp b/libs/filesystem/v3/example/file_size.cpp new file mode 100644 index 0000000000..3fbfa4ea53 --- /dev/null +++ b/libs/filesystem/v3/example/file_size.cpp @@ -0,0 +1,44 @@ +// file_size program -------------------------------------------------------// + +// Copyright Beman Dawes, 2004 + +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/filesystem for documentation. + +#include <boost/filesystem/operations.hpp> +#include <iostream> + +namespace fs = boost::filesystem; + +int main( int argc, char* argv[] ) +{ + + if ( argc != 2 ) + { + std::cout << "Usage: file_size path\n"; + return 1; + } + + std::cout << "sizeof(intmax_t) is " << sizeof(boost::intmax_t) << '\n'; + + fs::path p( argv[1] ); + + if ( !fs::exists( p ) ) + { + std::cout << "not found: " << argv[1] << std::endl; + return 1; + } + + if ( !fs::is_regular( p ) ) + { + std::cout << "not a regular file: " << argv[1] << std::endl; + return 1; + } + + std::cout << "size of " << argv[1] << " is " << fs::file_size( p ) + << std::endl; + return 0; +} diff --git a/libs/filesystem/v3/example/file_status.cpp b/libs/filesystem/v3/example/file_status.cpp new file mode 100644 index 0000000000..5d3774fdde --- /dev/null +++ b/libs/filesystem/v3/example/file_status.cpp @@ -0,0 +1,117 @@ +// status.cpp ------------------------------------------------------------------------// + +// Copyright Beman Dawes 2011 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#include <iostream> +#include <boost/config.hpp> +#include <boost/version.hpp> +#include <boost/filesystem.hpp> +#include <boost/detail/lightweight_main.hpp> + +using std::cout; using std::endl; +using namespace boost::filesystem; + +namespace +{ + path p; + + void print_boost_macros() + { + std::cout << "Boost " + << BOOST_VERSION / 100000 << '.' + << BOOST_VERSION / 100 % 1000 << '.' + << BOOST_VERSION % 100 << ", " +# ifndef _WIN64 + << BOOST_COMPILER << ", " +# else + << BOOST_COMPILER << " with _WIN64 defined, " +# endif + << BOOST_STDLIB << ", " + << BOOST_PLATFORM + << std::endl; + } + + const char* file_type_tab[] = + { "status_error", "file_not_found", "regular_file", "directory_file", + "symlink_file", "block_file", "character_file", "fifo_file", "socket_file", + "type_unknown" + }; + + const char* file_type_c_str(enum file_type t) + { + return file_type_tab[t]; + } + + void show_status(file_status s, boost::system::error_code ec) + { + boost::system::error_condition econd; + + if (ec) + { + econd = ec.default_error_condition(); + cout << "sets ec to indicate an error:\n" + << " ec.value() is " << ec.value() << '\n' + << " ec.message() is \"" << ec.message() << "\"\n" + << " ec.default_error_condition().value() is " << econd.value() << '\n' + << " ec.default_error_condition().message() is \"" << econd.message() << "\"\n"; + } + else + cout << "clears ec.\n"; + + cout << "s.type() is " << s.type() + << ", which is defined as \"" << file_type_c_str(s.type()) << "\"\n"; + + cout << "exists(s) is " << (exists(s) ? "true" : "false") << "\n"; + cout << "status_known(s) is " << (status_known(s) ? "true" : "false") << "\n"; + cout << "is_regular_file(s) is " << (is_regular_file(s) ? "true" : "false") << "\n"; + cout << "is_directory(s) is " << (is_directory(s) ? "true" : "false") << "\n"; + cout << "is_other(s) is " << (is_other(s) ? "true" : "false") << "\n"; + cout << "is_symlink(s) is " << (is_symlink(s) ? "true" : "false") << "\n"; + } + + void try_exists() + { + cout << "\nexists(" << p << ") "; + try + { + bool result = exists(p); + cout << "is " << (result ? "true" : "false") << "\n"; + } + catch (const filesystem_error& ex) + { + cout << "throws a filesystem_error exception: " << ex.what() << "\n"; + } + } + +} + +int cpp_main(int argc, char* argv[]) +{ + print_boost_macros(); + + if (argc < 2) + { + std::cout << "Usage: file_status <path>\n"; + p = argv[0]; + } + else + p = argv[1]; + + boost::system::error_code ec; + file_status s = status(p, ec); + cout << "\nfile_status s = status(" << p << ", ec) "; + show_status(s, ec); + + s = symlink_status(p, ec); + cout << "\nfile_status s = symlink_status(" << p << ", ec) "; + show_status(s, ec); + + try_exists(); + + return 0; +} diff --git a/libs/filesystem/v3/example/mbcopy.cpp b/libs/filesystem/v3/example/mbcopy.cpp new file mode 100644 index 0000000000..2b1f603823 --- /dev/null +++ b/libs/filesystem/v3/example/mbcopy.cpp @@ -0,0 +1,90 @@ +// Boost.Filesystem mbcopy.cpp ---------------------------------------------// + +// Copyright Beman Dawes 2005 + +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Copy the files in a directory, using mbpath to represent the new file names +// See http://../doc/path.htm#mbpath for more information + +// See deprecated_test for tests of deprecated features +#define BOOST_FILESYSTEM_NO_DEPRECATED + +#include <boost/filesystem/config.hpp> +# ifdef BOOST_FILESYSTEM_NARROW_ONLY +# error This compiler or standard library does not support wide-character strings or paths +# endif + +#include "mbpath.hpp" +#include <iostream> +#include <boost/filesystem/operations.hpp> +#include <boost/filesystem/fstream.hpp> +#include "../src/utf8_codecvt_facet.hpp" + +namespace fs = boost::filesystem; + +namespace +{ + // we can't use boost::filesystem::copy_file() because the argument types + // differ, so provide a not-very-smart replacement. + + void copy_file( const fs::wpath & from, const user::mbpath & to ) + { + fs::ifstream from_file( from, std::ios_base::in | std::ios_base::binary ); + if ( !from_file ) { std::cout << "input open failed\n"; return; } + + fs::ofstream to_file( to, std::ios_base::out | std::ios_base::binary ); + if ( !to_file ) { std::cout << "output open failed\n"; return; } + + char c; + while ( from_file.get(c) ) + { + to_file.put(c); + if ( to_file.fail() ) { std::cout << "write error\n"; return; } + } + + if ( !from_file.eof() ) { std::cout << "read error\n"; } + } +} + +int main( int argc, char * argv[] ) +{ + if ( argc != 2 ) + { + std::cout << "Copy files in the current directory to a target directory\n" + << "Usage: mbcopy <target-dir>\n"; + return 1; + } + + // For encoding, use Boost UTF-8 codecvt + std::locale global_loc = std::locale(); + std::locale loc( global_loc, new fs::detail::utf8_codecvt_facet ); + user::mbpath_traits::imbue( loc ); + + std::string target_string( argv[1] ); + user::mbpath target_dir( user::mbpath_traits::to_internal( target_string ) ); + + if ( !fs::is_directory( target_dir ) ) + { + std::cout << "Error: " << argv[1] << " is not a directory\n"; + return 1; + } + + for ( fs::wdirectory_iterator it( L"." ); + it != fs::wdirectory_iterator(); ++it ) + { + if ( fs::is_regular_file(it->status()) ) + { + copy_file( *it, target_dir / it->path().filename() ); + } + } + + return 0; +} + + + + + diff --git a/libs/filesystem/v3/example/mbpath.cpp b/libs/filesystem/v3/example/mbpath.cpp new file mode 100644 index 0000000000..43590010f3 --- /dev/null +++ b/libs/filesystem/v3/example/mbpath.cpp @@ -0,0 +1,80 @@ +// Boost.Filesystem mbpath.cpp ---------------------------------------------// + +// (c) Copyright Beman Dawes 2005 + +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See Boost.Filesystem home page at http://www.boost.org/libs/filesystem + +#include <boost/filesystem/config.hpp> +# ifdef BOOST_FILESYSTEM_NARROW_ONLY +# error This compiler or standard library does not support wide-character strings or paths +# endif + +#include "mbpath.hpp" +#include <boost/system/system_error.hpp> +#include <boost/scoped_array.hpp> + +namespace fs = boost::filesystem; + +namespace +{ + // ISO C calls this "the locale-specific native environment": + std::locale loc(""); + + const std::codecvt<wchar_t, char, std::mbstate_t> * + cvt( &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > + ( loc ) ); +} + +namespace user +{ + mbpath_traits::external_string_type + mbpath_traits::to_external( const mbpath & ph, + const internal_string_type & src ) + { + std::size_t work_size( cvt->max_length() * (src.size()+1) ); + boost::scoped_array<char> work( new char[ work_size ] ); + std::mbstate_t state; + const internal_string_type::value_type * from_next; + external_string_type::value_type * to_next; + if ( cvt->out( + state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), + work.get()+work_size, to_next ) != std::codecvt_base::ok ) + boost::throw_exception<fs::basic_filesystem_error<mbpath> >( + fs::basic_filesystem_error<mbpath>( + "user::mbpath::to_external conversion error", + ph, boost::system::error_code( EINVAL, boost::system::errno_ecat ) ) ); + *to_next = '\0'; + return external_string_type( work.get() ); + } + + mbpath_traits::internal_string_type + mbpath_traits::to_internal( const external_string_type & src ) + { + std::size_t work_size( src.size()+1 ); + boost::scoped_array<wchar_t> work( new wchar_t[ work_size ] ); + std::mbstate_t state; + const external_string_type::value_type * from_next; + internal_string_type::value_type * to_next; + if ( cvt->in( + state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), + work.get()+work_size, to_next ) != std::codecvt_base::ok ) + boost::throw_exception<fs::basic_filesystem_error<mbpath> >( + fs::basic_filesystem_error<mbpath>( + "user::mbpath::to_internal conversion error", + boost::system::error_code( EINVAL, boost::system::errno_ecat ) ) ); + *to_next = L'\0'; + return internal_string_type( work.get() ); + } + + void mbpath_traits::imbue( const std::locale & new_loc ) + { + loc = new_loc; + cvt = &std::use_facet + <std::codecvt<wchar_t, char, std::mbstate_t> >( loc ); + } + +} // namespace user diff --git a/libs/filesystem/v3/example/mbpath.hpp b/libs/filesystem/v3/example/mbpath.hpp new file mode 100644 index 0000000000..f752b3fd0d --- /dev/null +++ b/libs/filesystem/v3/example/mbpath.hpp @@ -0,0 +1,44 @@ +// Boost.Filesystem mbpath.hpp ---------------------------------------------// + +// Copyright Beman Dawes 2005 + +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Encodes wide character paths as MBCS +// See http://../doc/path.htm#mbpath for more information + +#include <boost/filesystem/path.hpp> +#include <cwchar> // for std::mbstate_t +#include <string> +#include <locale> + +namespace user +{ + struct mbpath_traits; + + typedef boost::filesystem::basic_path<std::wstring, mbpath_traits> mbpath; + + struct mbpath_traits + { + typedef std::wstring internal_string_type; + typedef std::string external_string_type; + + static external_string_type to_external( const mbpath & ph, + const internal_string_type & src ); + + static internal_string_type to_internal( const external_string_type & src ); + + static void imbue( const std::locale & loc ); + }; +} // namespace user + +namespace boost +{ + namespace filesystem + { + template<> struct is_basic_path<user::mbpath> + { static const bool value = true; }; + } +} diff --git a/libs/filesystem/v3/example/path_info.cpp b/libs/filesystem/v3/example/path_info.cpp new file mode 100644 index 0000000000..5c32b205a0 --- /dev/null +++ b/libs/filesystem/v3/example/path_info.cpp @@ -0,0 +1,83 @@ +// path_info.cpp ---------------------------------------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#include <iostream> +#include <boost/filesystem.hpp> +using namespace std; +using namespace boost::filesystem; + +const char * say_what(bool b) { return b ? "true" : "false"; } + +int main(int argc, char* argv[]) +{ + if (argc < 2) + { + cout << "Usage: path_info path-portion...\n" + "Example: path_info foo/bar baz\n" +# ifdef BOOST_POSIX_API + " would report info about the composed path foo/bar/baz\n"; +# else // BOOST_WINDOWS_API + " would report info about the composed path foo/bar\\baz\n"; +# endif + return 1; + } + + path p; // compose a path from the command line arguments + + for (; argc > 1; --argc, ++argv) + p /= argv[1]; + + cout << "\ncomposed path:\n"; + cout << " cout << -------------: " << p << "\n"; + cout << " make_preferred()----------: " << path(p).make_preferred() << "\n"; + + cout << "\nelements:\n"; + + for (path::iterator it(p.begin()), it_end(p.end()); it != it_end; ++it) + cout << " " << *it << '\n'; + + cout << "\nobservers, native format:" << endl; +# ifdef BOOST_POSIX_API + cout << " native()-------------: " << p.native() << endl; + cout << " c_str()--------------: " << p.c_str() << endl; +# else // BOOST_WINDOWS_API + wcout << L" native()-------------: " << p.native() << endl; + wcout << L" c_str()--------------: " << p.c_str() << endl; +# endif + cout << " string()-------------: " << p.string() << endl; + wcout << L" wstring()------------: " << p.wstring() << endl; + + cout << "\nobservers, generic format:\n"; + cout << " generic_string()-----: " << p.generic_string() << endl; + wcout << L" generic_wstring()----: " << p.generic_wstring() << endl; + + cout << "\ndecomposition:\n"; + cout << " root_name()----------: " << p.root_name() << '\n'; + cout << " root_directory()-----: " << p.root_directory() << '\n'; + cout << " root_path()----------: " << p.root_path() << '\n'; + cout << " relative_path()------: " << p.relative_path() << '\n'; + cout << " parent_path()--------: " << p.parent_path() << '\n'; + cout << " filename()-----------: " << p.filename() << '\n'; + cout << " stem()---------------: " << p.stem() << '\n'; + cout << " extension()----------: " << p.extension() << '\n'; + + cout << "\nquery:\n"; + cout << " empty()--------------: " << say_what(p.empty()) << '\n'; + cout << " is_absolute()--------: " << say_what(p.is_absolute()) << '\n'; + cout << " has_root_name()------: " << say_what(p.has_root_name()) << '\n'; + cout << " has_root_directory()-: " << say_what(p.has_root_directory()) << '\n'; + cout << " has_root_path()------: " << say_what(p.has_root_path()) << '\n'; + cout << " has_relative_path()--: " << say_what(p.has_relative_path()) << '\n'; + cout << " has_parent_path()----: " << say_what(p.has_parent_path()) << '\n'; + cout << " has_filename()-------: " << say_what(p.has_filename()) << '\n'; + cout << " has_stem()-----------: " << say_what(p.has_stem()) << '\n'; + cout << " has_extension()------: " << say_what(p.has_extension()) << '\n'; + + return 0; +} diff --git a/libs/filesystem/v3/example/simple_ls.cpp b/libs/filesystem/v3/example/simple_ls.cpp new file mode 100644 index 0000000000..9c4b638052 --- /dev/null +++ b/libs/filesystem/v3/example/simple_ls.cpp @@ -0,0 +1,91 @@ +// simple_ls program -------------------------------------------------------// + +// Copyright Jeff Garland and Beman Dawes, 2002 + +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/filesystem for documentation. + +#define BOOST_FILESYSTEM_VERSION 3 + +// As an example program, we don't want to use any deprecated features +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +# define BOOST_FILESYSTEM_NO_DEPRECATED +#endif +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include "boost/filesystem/operations.hpp" +#include "boost/filesystem/path.hpp" +#include "boost/progress.hpp" +#include <iostream> + +namespace fs = boost::filesystem; + +int main(int argc, char* argv[]) +{ + fs::path p(fs::current_path()); + + if (argc > 1) + p = fs::system_complete(argv[1]); + else + std::cout << "\nusage: simple_ls [path]" << std::endl; + + unsigned long file_count = 0; + unsigned long dir_count = 0; + unsigned long other_count = 0; + unsigned long err_count = 0; + + if (!fs::exists(p)) + { + std::cout << "\nNot found: " << p << std::endl; + return 1; + } + + if (fs::is_directory(p)) + { + std::cout << "\nIn directory: " << p << "\n\n"; + fs::directory_iterator end_iter; + for (fs::directory_iterator dir_itr(p); + dir_itr != end_iter; + ++dir_itr) + { + try + { + if (fs::is_directory(dir_itr->status())) + { + ++dir_count; + std::cout << dir_itr->path().filename() << " [directory]\n"; + } + else if (fs::is_regular_file(dir_itr->status())) + { + ++file_count; + std::cout << dir_itr->path().filename() << "\n"; + } + else + { + ++other_count; + std::cout << dir_itr->path().filename() << " [other]\n"; + } + + } + catch (const std::exception & ex) + { + ++err_count; + std::cout << dir_itr->path().filename() << " " << ex.what() << std::endl; + } + } + std::cout << "\n" << file_count << " files\n" + << dir_count << " directories\n" + << other_count << " others\n" + << err_count << " errors\n"; + } + else // must be a file + { + std::cout << "\nFound: " << p << "\n"; + } + return 0; +} diff --git a/libs/filesystem/v3/example/stems.cpp b/libs/filesystem/v3/example/stems.cpp new file mode 100644 index 0000000000..3699fa81f3 --- /dev/null +++ b/libs/filesystem/v3/example/stems.cpp @@ -0,0 +1,31 @@ +// filesystem example stems.cpp ------------------------------------------------------// + +// Copyright Beman Dawes 2011 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#include <boost/filesystem.hpp> +#include <iostream> + +int main(int argc, char* argv[]) +{ + if (argc < 2) + { + std::cout << "Usage: stems <path>\n"; + return 1; + } + + boost::filesystem::path p(argv[1]), name(p.filename()); + + for(;;) + { + std::cout << "filename " << name << " has stem " << name.stem() + << " and extension " << name.extension() << "\n"; + if (name.stem().empty() || name.extension().empty()) + return 0; + name = name.stem(); + } +} diff --git a/libs/filesystem/v3/example/tchar.cpp b/libs/filesystem/v3/example/tchar.cpp new file mode 100644 index 0000000000..5f33d69e06 --- /dev/null +++ b/libs/filesystem/v3/example/tchar.cpp @@ -0,0 +1,39 @@ +// Example use of Microsoft TCHAR ----------------------------------------------------// + +// Copyright Beman Dawes 2008 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/operations.hpp> +#include <string> +#include <cassert> +#include <windows.h> +#include <winnt.h> + +namespace fs = boost::filesystem; + +typedef std::basic_string<TCHAR> tstring; + +void func( const fs::path & p ) +{ + assert( fs::exists( p ) ); +} + +int main() +{ + // get a path that is known to exist + fs::path cp = fs::current_path(); + + // demo: get tstring from the path + tstring cp_as_tstring = cp.string<tstring>(); + + // demo: pass tstring to filesystem function taking path + assert( fs::exists( cp_as_tstring ) ); + + // demo: pass tstring to user function taking path + func( cp_as_tstring ); + + return 0; +} diff --git a/libs/filesystem/v3/example/test/Jamfile.v2 b/libs/filesystem/v3/example/test/Jamfile.v2 new file mode 100644 index 0000000000..3b3dde5f45 --- /dev/null +++ b/libs/filesystem/v3/example/test/Jamfile.v2 @@ -0,0 +1,31 @@ +# Boost Filesystem Library Tutorial Jamfile + +# (C) Copyright Beman Dawes 2010 +# (C) Copyright Vladimir Prus 2003 + +# Distributed under the Boost Software License, Version 1.0. +# See www.boost.org/LICENSE_1_0.txt + +# Library home page: http://www.boost.org/libs/filesystem + +project + : requirements + <library>/boost/filesystem//boost_filesystem + <library>/boost/system//boost_system + <toolset>msvc:<asynch-exceptions>on + ; + +exe tut1 : tut1.cpp ; +exe tut2 : tut2.cpp ; +exe tut3 : tut3.cpp ; +exe tut4 : tut4.cpp ; +exe tut5 : tut5.cpp ; +exe path_info : path_info.cpp ; + +install tut1-copy : tut1 : <location>. ; +install tut2-copy : tut2 : <location>. ; +install tut3-copy : tut3 : <location>. ; +install tut4-copy : tut4 : <location>. ; +install tut5-copy : tut5 : <location>. ; +install path_info-copy : path_info : <location>. ; + diff --git a/libs/filesystem/v3/example/test/bld.bat b/libs/filesystem/v3/example/test/bld.bat new file mode 100644 index 0000000000..97686006d2 --- /dev/null +++ b/libs/filesystem/v3/example/test/bld.bat @@ -0,0 +1,7 @@ +@echo off +rem Copyright Beman Dawes, 2010 +rem Distributed under the Boost Software License, Version 1.0. +rem See www.boost.org/LICENSE_1_0.txt + +bjam %* >bjam.log +find "error" <bjam.log diff --git a/libs/filesystem/v3/example/test/bld.sh b/libs/filesystem/v3/example/test/bld.sh new file mode 100755 index 0000000000..0754fc9d6f --- /dev/null +++ b/libs/filesystem/v3/example/test/bld.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# Copyright Beman Dawes, 2010 +# Distributed under the Boost Software License, Version 1.0. +# See www.boost.org/LICENSE_1_0.txt + +bjam $* >bjam.log +grep "error" <bjam.log diff --git a/libs/filesystem/v3/example/test/setup.bat b/libs/filesystem/v3/example/test/setup.bat new file mode 100644 index 0000000000..23a73f4693 --- /dev/null +++ b/libs/filesystem/v3/example/test/setup.bat @@ -0,0 +1,13 @@ +@echo off +rem Copyright Beman Dawes, 2010 +rem Distributed under the Boost Software License, Version 1.0. +rem See www.boost.org/LICENSE_1_0.txt + +copy /y ..\tut1.cpp >nul +copy /y ..\tut2.cpp >nul +copy /y ..\tut3.cpp >nul +copy /y ..\tut4.cpp >nul +copy /y ..\tut5.cpp >nul +copy /y ..\path_info.cpp >nul +del *.exe 2>nul +del *.pdb 2>nul diff --git a/libs/filesystem/v3/example/test/setup.sh b/libs/filesystem/v3/example/test/setup.sh new file mode 100755 index 0000000000..c2f3c79815 --- /dev/null +++ b/libs/filesystem/v3/example/test/setup.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Copyright Beman Dawes, 2010 +# Distributed under the Boost Software License, Version 1.0. +# See www.boost.org/LICENSE_1_0.txt + +cp ../tut1.cpp . +cp ../tut2.cpp . +cp ../tut3.cpp . +cp ../tut4.cpp . +cp ../tut5.cpp . +cp ../path_info.cpp . +rm tut1 2>~/junk +rm tut2 2>~/junk +rm tut3 2>~/junk +rm tut4 2>~/junk +rm tut5 2>~/junk +rm path_info 2>~/junk + diff --git a/libs/filesystem/v3/example/tut0.cpp b/libs/filesystem/v3/example/tut0.cpp new file mode 100644 index 0000000000..4055100996 --- /dev/null +++ b/libs/filesystem/v3/example/tut0.cpp @@ -0,0 +1,25 @@ +// filesystem tut0.cpp ---------------------------------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#include <iostream> +#include <boost/filesystem.hpp> +namespace fs = boost::filesystem; + +int main(int argc, char* argv[]) +{ + if (argc < 2) + { + std::cout << "Usage: tut0 path\n"; + return 1; + } + + std::cout << argv[1] << '\n'; + + return 0; +} diff --git a/libs/filesystem/v3/example/tut1.cpp b/libs/filesystem/v3/example/tut1.cpp new file mode 100644 index 0000000000..3ac85b9035 --- /dev/null +++ b/libs/filesystem/v3/example/tut1.cpp @@ -0,0 +1,23 @@ +// filesystem tut1.cpp ---------------------------------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#include <iostream> +#include <boost/filesystem.hpp> +using namespace boost::filesystem; + +int main(int argc, char* argv[]) +{ + if (argc < 2) + { + std::cout << "Usage: tut1 path\n"; + return 1; + } + std::cout << argv[1] << " " << file_size(argv[1]) << '\n'; + return 0; +} diff --git a/libs/filesystem/v3/example/tut2.cpp b/libs/filesystem/v3/example/tut2.cpp new file mode 100644 index 0000000000..2ca8562d2b --- /dev/null +++ b/libs/filesystem/v3/example/tut2.cpp @@ -0,0 +1,40 @@ +// filesystem tut2.cpp ---------------------------------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#include <iostream> +#include <boost/filesystem.hpp> +using namespace std; +using namespace boost::filesystem; + +int main(int argc, char* argv[]) +{ + if (argc < 2) + { + cout << "Usage: tut2 path\n"; + return 1; + } + + path p (argv[1]); // p reads clearer than argv[1] in the following code + + if (exists(p)) // does p actually exist? + { + if (is_regular_file(p)) // is p a regular file? + cout << p << " size is " << file_size(p) << '\n'; + + else if (is_directory(p)) // is p a directory? + cout << p << " is a directory\n"; + + else + cout << p << " exists, but is neither a regular file nor a directory\n"; + } + else + cout << p << " does not exist\n"; + + return 0; +} diff --git a/libs/filesystem/v3/example/tut3.cpp b/libs/filesystem/v3/example/tut3.cpp new file mode 100644 index 0000000000..bb4494eaf0 --- /dev/null +++ b/libs/filesystem/v3/example/tut3.cpp @@ -0,0 +1,56 @@ +// filesystem tut3.cpp ---------------------------------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#include <iostream> +#include <iterator> +#include <algorithm> +#include <boost/filesystem.hpp> +using namespace std; +using namespace boost::filesystem; + +int main(int argc, char* argv[]) +{ + if (argc < 2) + { + cout << "Usage: tut3 path\n"; + return 1; + } + + path p (argv[1]); // p reads clearer than argv[1] in the following code + + try + { + if (exists(p)) // does p actually exist? + { + if (is_regular_file(p)) // is p a regular file? + cout << p << " size is " << file_size(p) << '\n'; + + else if (is_directory(p)) // is p a directory? + { + cout << p << " is a directory containing:\n"; + + copy(directory_iterator(p), directory_iterator(), // directory_iterator::value_type + ostream_iterator<directory_entry>(cout, "\n")); // is directory_entry, which is + // converted to a path by the + // path stream inserter + } + else + cout << p << " exists, but is neither a regular file nor a directory\n"; + } + else + cout << p << " does not exist\n"; + } + + catch (const filesystem_error& ex) + { + cout << ex.what() << '\n'; + } + + return 0; +} diff --git a/libs/filesystem/v3/example/tut4.cpp b/libs/filesystem/v3/example/tut4.cpp new file mode 100644 index 0000000000..5888c3acbf --- /dev/null +++ b/libs/filesystem/v3/example/tut4.cpp @@ -0,0 +1,65 @@ +// filesystem tut4.cpp ---------------------------------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#include <iostream> +#include <iterator> +#include <vector> +#include <algorithm> +#include <boost/filesystem.hpp> +using namespace std; +using namespace boost::filesystem; + +int main(int argc, char* argv[]) +{ + if (argc < 2) + { + cout << "Usage: tut4 path\n"; + return 1; + } + + path p (argv[1]); // p reads clearer than argv[1] in the following code + + try + { + if (exists(p)) // does p actually exist? + { + if (is_regular_file(p)) // is p a regular file? + cout << p << " size is " << file_size(p) << '\n'; + + else if (is_directory(p)) // is p a directory? + { + cout << p << " is a directory containing:\n"; + + typedef vector<path> vec; // store paths, + vec v; // so we can sort them later + + copy(directory_iterator(p), directory_iterator(), back_inserter(v)); + + sort(v.begin(), v.end()); // sort, since directory iteration + // is not ordered on some file systems + + for (vec::const_iterator it(v.begin()), it_end(v.end()); it != it_end; ++it) + { + cout << " " << *it << '\n'; + } + } + else + cout << p << " exists, but is neither a regular file nor a directory\n"; + } + else + cout << p << " does not exist\n"; + } + + catch (const filesystem_error& ex) + { + cout << ex.what() << '\n'; + } + + return 0; +} diff --git a/libs/filesystem/v3/example/tut5.cpp b/libs/filesystem/v3/example/tut5.cpp new file mode 100644 index 0000000000..d665b0db05 --- /dev/null +++ b/libs/filesystem/v3/example/tut5.cpp @@ -0,0 +1,52 @@ +// filesystem tut5.cpp ---------------------------------------------------------------// + +// Copyright Beman Dawes 2010 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#include <boost/filesystem/fstream.hpp> +#include <string> +#include <list> +namespace fs = boost::filesystem; + +int main() +{ + // \u263A is "Unicode WHITE SMILING FACE = have a nice day!" + std::string narrow_string ("smile2"); + std::wstring wide_string (L"smile2\u263A"); + std::list<char> narrow_list; + narrow_list.push_back('s'); + narrow_list.push_back('m'); + narrow_list.push_back('i'); + narrow_list.push_back('l'); + narrow_list.push_back('e'); + narrow_list.push_back('3'); + std::list<wchar_t> wide_list; + wide_list.push_back(L's'); + wide_list.push_back(L'm'); + wide_list.push_back(L'i'); + wide_list.push_back(L'l'); + wide_list.push_back(L'e'); + wide_list.push_back(L'3'); + wide_list.push_back(L'\u263A'); + + { fs::ofstream f("smile"); } + { fs::ofstream f(L"smile\u263A"); } + { fs::ofstream f(narrow_string); } + { fs::ofstream f(wide_string); } + { fs::ofstream f(narrow_list); } + { fs::ofstream f(wide_list); } + narrow_list.pop_back(); + narrow_list.push_back('4'); + wide_list.pop_back(); + wide_list.pop_back(); + wide_list.push_back(L'4'); + wide_list.push_back(L'\u263A'); + { fs::ofstream f(fs::path(narrow_list.begin(), narrow_list.end())); } + { fs::ofstream f(fs::path(wide_list.begin(), wide_list.end())); } + + return 0; +} diff --git a/libs/filesystem/v3/index.html b/libs/filesystem/v3/index.html new file mode 100644 index 0000000000..bbd0918eca --- /dev/null +++ b/libs/filesystem/v3/index.html @@ -0,0 +1,14 @@ +<html> +<head> +<meta http-equiv="refresh" content="0; URL=doc/index.htm"> +</head> +<body> +Automatic redirection failed, please go to +<a href="doc/index.htm">doc/index.htm</a>. +<hr> +<p>© Copyright Beman Dawes, 2003</p> +<p> Distributed under the Boost Software +License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> +www.boost.org/LICENSE_1_0.txt</a>)</p> +</body> +</html> diff --git a/libs/filesystem/v3/src/codecvt_error_category.cpp b/libs/filesystem/v3/src/codecvt_error_category.cpp new file mode 100644 index 0000000000..b35b4a9ae7 --- /dev/null +++ b/libs/filesystem/v3/src/codecvt_error_category.cpp @@ -0,0 +1,93 @@ +// codecvt_error_category implementation file ----------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt) + +// Library home page at http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +#include <boost/config.hpp> +#if !defined( BOOST_NO_STD_WSTRING ) +// Boost.Filesystem V3 and later requires std::wstring support. +// During the transition to V3, libraries are compiled with both V2 and V3 sources. +// On old compilers that don't support V3 anyhow, we just skip everything so the compile +// will succeed and the library can be built. + +#include <boost/config/warning_disable.hpp> + +// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/v3/config.hpp> +#include <boost/filesystem/v3/path_traits.hpp> +#include <boost/system/error_code.hpp> +#include <locale> +#include <vector> +#include <cstdlib> +#include <cassert> + +//--------------------------------------------------------------------------------------// + +namespace +{ + class codecvt_error_cat : public boost::system::error_category + { + public: + codecvt_error_cat(){} + const char* name() const; + std::string message(int ev) const; + }; + + const char* codecvt_error_cat::name() const + { + return "codecvt"; + } + + std::string codecvt_error_cat::message(int ev) const + { + std::string str; + switch (ev) + { + case std::codecvt_base::ok: + str = "ok"; + break; + case std::codecvt_base::partial: + str = "partial"; + break; + case std::codecvt_base::error: + str = "error"; + break; + case std::codecvt_base::noconv: + str = "noconv"; + break; + default: + str = "unknown error"; + } + return str; + } + +} // unnamed namespace + +namespace boost +{ + namespace filesystem3 + { + + BOOST_FILESYSTEM_DECL const boost::system::error_category& codecvt_error_category() + { + static const codecvt_error_cat codecvt_error_cat_const; + return codecvt_error_cat_const; + } + + } // namespace filesystem3 +} // namespace boost + +#endif // no wide character support diff --git a/libs/filesystem/v3/src/operations.cpp b/libs/filesystem/v3/src/operations.cpp new file mode 100644 index 0000000000..226f107690 --- /dev/null +++ b/libs/filesystem/v3/src/operations.cpp @@ -0,0 +1,2209 @@ +// operations.cpp --------------------------------------------------------------------// + +// Copyright 2002-2009 Beman Dawes +// Copyright 2001 Dietmar Kuehl + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// See library home page at http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +// define 64-bit offset macros BEFORE including boost/config.hpp (see ticket #5355) +#if !(defined(__HP_aCC) && defined(_ILP32) && !defined(_STATVFS_ACPP_PROBLEMS_FIXED)) +#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect, +#endif +#if !defined(__PGI) +#define __USE_FILE_OFFSET64 // but that is harmless on Windows and on POSIX + // 64-bit systems or on 32-bit systems which don't have files larger + // than can be represented by a traditional POSIX/UNIX off_t type. + // OTOH, defining them should kick in 64-bit off_t's (and thus + // st_size)on 32-bit systems that provide the Large File + // Support (LFS)interface, such as Linux, Solaris, and IRIX. + // The defines are given before any headers are included to + // ensure that they are available to all included headers. + // That is required at least on Solaris, and possibly on other + // systems as well. +#else +#define _FILE_OFFSET_BITS 64 +#endif + +#include <boost/config.hpp> +#if !defined( BOOST_NO_STD_WSTRING ) +// Boost.Filesystem V3 and later requires std::wstring support. +// During the transition to V3, libraries are compiled with both V2 and V3 sources. +// On old compilers that don't support V3 anyhow, we just skip everything so the compile +// will succeed and the library can be built. + +// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) + +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r()needs this +#endif + +#include <boost/filesystem/v3/operations.hpp> +#include <boost/scoped_array.hpp> +#include <boost/detail/workaround.hpp> +#include <vector> +#include <cstdlib> // for malloc, free +#include <sys/stat.h> // even on Windows some functions use stat() +#include <cstring> +#include <cstdio> // for remove, rename +#if defined(__QNXNTO__) // see ticket #5355 +# include <stdio.h> +#endif +#include <cerrno> + +#ifdef BOOST_FILEYSTEM_INCLUDE_IOSTREAM +# include <iostream> +#endif + +namespace fs = boost::filesystem3; +using boost::filesystem3::path; +using boost::filesystem3::filesystem_error; +using boost::filesystem3::perms; +using boost::system::error_code; +using boost::system::error_category; +using boost::system::system_category; +using std::string; +using std::wstring; + +# ifdef BOOST_POSIX_API + + const fs::path dot_path("."); + const fs::path dot_dot_path(".."); +# include <sys/types.h> +# if !defined(__APPLE__) && !defined(__OpenBSD__) +# include <sys/statvfs.h> +# define BOOST_STATVFS statvfs +# define BOOST_STATVFS_F_FRSIZE vfs.f_frsize +# else +# ifdef __OpenBSD__ +# include <sys/param.h> +# endif +# include <sys/mount.h> +# define BOOST_STATVFS statfs +# define BOOST_STATVFS_F_FRSIZE static_cast<boost::uintmax_t>(vfs.f_bsize) +# endif +# include <dirent.h> +# include <unistd.h> +# include <fcntl.h> +# include <utime.h> +# include "limits.h" + +# else // BOOST_WINDOW_API + + const fs::path dot_path(L"."); + const fs::path dot_dot_path(L".."); +# if (defined(__MINGW32__) || defined(__CYGWIN__)) && !defined(WINVER) + // Versions of MinGW or Cygwin that support Filesystem V3 support at least WINVER 0x501. + // See MinGW's windef.h +# define WINVER 0x501 +# endif +# include <io.h> +# include <windows.h> +# include <winnt.h> +# if !defined(_WIN32_WINNT) +# define _WIN32_WINNT 0x0500 +# endif +# if defined(__BORLANDC__) || defined(__MWERKS__) +# if defined(__BORLANDC__) + using std::time_t; +# endif +# include <utime.h> +# else +# include <sys/utime.h> +# endif + +// REPARSE_DATA_BUFFER related definitions are found in ntifs.h, which is part of the +// Windows Device Driver Kit. Since that's inconvenient, the definitions are provided +// here. See http://msdn.microsoft.com/en-us/library/ms791514.aspx + +#if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) // mingw winnt.h does provide the defs + +#define SYMLINK_FLAG_RELATIVE 1 + +typedef struct _REPARSE_DATA_BUFFER { + ULONG ReparseTag; + USHORT ReparseDataLength; + USHORT Reserved; + union { + struct { + USHORT SubstituteNameOffset; + USHORT SubstituteNameLength; + USHORT PrintNameOffset; + USHORT PrintNameLength; + ULONG Flags; + WCHAR PathBuffer[1]; + /* Example of distinction between substitute and print names: + mklink /d ldrive c:\ + SubstituteName: c:\\??\ + PrintName: c:\ + */ + } SymbolicLinkReparseBuffer; + struct { + USHORT SubstituteNameOffset; + USHORT SubstituteNameLength; + USHORT PrintNameOffset; + USHORT PrintNameLength; + WCHAR PathBuffer[1]; + } MountPointReparseBuffer; + struct { + UCHAR DataBuffer[1]; + } GenericReparseBuffer; + }; +} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; + +#define REPARSE_DATA_BUFFER_HEADER_SIZE \ + FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer) + +#endif + +#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE +#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 ) +#endif + +# ifndef FSCTL_GET_REPARSE_POINT +# define FSCTL_GET_REPARSE_POINT 0x900a8 +# endif + +# ifndef IO_REPARSE_TAG_SYMLINK +# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) +# endif + +# endif // BOOST_WINDOWS_API + +// BOOST_FILESYSTEM_STATUS_CACHE enables file_status cache in +// dir_itr_increment. The config tests are placed here because some of the +// macros being tested come from dirent.h. +// +// TODO: find out what macros indicate dirent::d_type present in more libraries +# if defined(BOOST_WINDOWS_API)\ + || defined(_DIRENT_HAVE_D_TYPE)// defined by GNU C library if d_type present +# define BOOST_FILESYSTEM_STATUS_CACHE +# endif + +// POSIX/Windows macros ----------------------------------------------------// + +// Portions of the POSIX and Windows API's are very similar, except for name, +// order of arguments, and meaning of zero/non-zero returns. The macros below +// abstract away those differences. They follow Windows naming and order of +// arguments, and return true to indicate no error occurred. [POSIX naming, +// order of arguments, and meaning of return were followed initially, but +// found to be less clear and cause more coding errors.] + +# if defined(BOOST_POSIX_API) + +// POSIX uses a 0 return to indicate success +# define BOOST_ERRNO errno +# define BOOST_SET_CURRENT_DIRECTORY(P)(::chdir(P)== 0) +# define BOOST_CREATE_DIRECTORY(P)(::mkdir(P, S_IRWXU|S_IRWXG|S_IRWXO)== 0) +# define BOOST_CREATE_HARD_LINK(F,T)(::link(T, F)== 0) +# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(::symlink(T, F)== 0) +# define BOOST_REMOVE_DIRECTORY(P)(::rmdir(P)== 0) +# define BOOST_DELETE_FILE(P)(::unlink(P)== 0) +# define BOOST_COPY_DIRECTORY(F,T)(!(::stat(from.c_str(), &from_stat)!= 0\ + || ::mkdir(to.c_str(),from_stat.st_mode)!= 0)) +# define BOOST_COPY_FILE(F,T,FailIfExistsBool)copy_file_api(F, T, FailIfExistsBool) +# define BOOST_MOVE_FILE(OLD,NEW)(::rename(OLD, NEW)== 0) +# define BOOST_RESIZE_FILE(P,SZ)(::truncate(P, SZ)== 0) + +# define BOOST_ERROR_NOT_SUPPORTED ENOSYS +# define BOOST_ERROR_ALREADY_EXISTS EEXIST + +# else // BOOST_WINDOWS_API + +// Windows uses a non-0 return to indicate success +# define BOOST_ERRNO ::GetLastError() +# define BOOST_SET_CURRENT_DIRECTORY(P)(::SetCurrentDirectoryW(P)!= 0) +# define BOOST_CREATE_DIRECTORY(P)(::CreateDirectoryW(P, 0)!= 0) +# define BOOST_CREATE_HARD_LINK(F,T)(create_hard_link_api(F, T, 0)!= 0) +# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(create_symbolic_link_api(F, T, Flag)!= 0) +# define BOOST_REMOVE_DIRECTORY(P)(::RemoveDirectoryW(P)!= 0) +# define BOOST_DELETE_FILE(P)(::DeleteFileW(P)!= 0) +# define BOOST_COPY_DIRECTORY(F,T)(::CreateDirectoryExW(F, T, 0)!= 0) +# define BOOST_COPY_FILE(F,T,FailIfExistsBool)(::CopyFileW(F, T, FailIfExistsBool)!= 0) +# define BOOST_MOVE_FILE(OLD,NEW)(::MoveFileExW(OLD, NEW, MOVEFILE_REPLACE_EXISTING)!= 0) +# define BOOST_RESIZE_FILE(P,SZ)(resize_file_api(P, SZ)!= 0) +# define BOOST_READ_SYMLINK(P,T) + +# define BOOST_ERROR_ALREADY_EXISTS ERROR_ALREADY_EXISTS +# define BOOST_ERROR_NOT_SUPPORTED ERROR_NOT_SUPPORTED + +# endif + +//--------------------------------------------------------------------------------------// +// // +// helpers (all operating systems) // +// // +//--------------------------------------------------------------------------------------// + +namespace +{ + + fs::file_type query_file_type(const path& p, error_code* ec); + + boost::filesystem3::directory_iterator end_dir_itr; + + const std::size_t buf_size(128); + const error_code ok; + + bool error(bool was_error, error_code* ec, const string& message) + { + if (!was_error) + { + if (ec != 0) ec->clear(); + } + else + { // error + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error(message, + error_code(BOOST_ERRNO, system_category()))); + else + ec->assign(BOOST_ERRNO, system_category()); + } + return was_error; + } + + bool error(bool was_error, const path& p, error_code* ec, const string& message) + { + if (!was_error) + { + if (ec != 0) ec->clear(); + } + else + { // error + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error(message, + p, error_code(BOOST_ERRNO, system_category()))); + else + ec->assign(BOOST_ERRNO, system_category()); + } + return was_error; + } + + bool error(bool was_error, const path& p1, const path& p2, error_code* ec, + const string& message) + { + if (!was_error) + { + if (ec != 0) ec->clear(); + } + else + { // error + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error(message, + p1, p2, error_code(BOOST_ERRNO, system_category()))); + else + ec->assign(BOOST_ERRNO, system_category()); + } + return was_error; + } + + bool error(bool was_error, const error_code& result, + const path& p, error_code* ec, const string& message) + // Overwrites ec if there has already been an error + { + if (!was_error) + { + if (ec != 0) ec->clear(); + } + else + { // error + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error(message, p, result)); + else + *ec = result; + } + return was_error; + } + + bool error(bool was_error, const error_code& result, + const path& p1, const path& p2, error_code* ec, const string& message) + // Overwrites ec if there has already been an error + { + if (!was_error) + { + if (ec != 0) ec->clear(); + } + else + { // error + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error(message, p1, p2, result)); + else + *ec = result; + } + return was_error; + } + + bool is_empty_directory(const path& p) + { + return fs::directory_iterator(p)== end_dir_itr; + } + + bool remove_directory(const path& p) // true if succeeds + { return BOOST_REMOVE_DIRECTORY(p.c_str()); } + + bool remove_file(const path& p) // true if succeeds + { return BOOST_DELETE_FILE(p.c_str()); } + + // called by remove and remove_all_aux + bool remove_file_or_directory(const path& p, fs::file_type type, error_code* ec) + // return true if file removed, false if not removed + { + if (type == fs::file_not_found) + { + if (ec != 0) ec->clear(); + return false; + } + + if (type == fs::directory_file +# ifdef BOOST_WINDOWS_API + || type == fs::_detail_directory_symlink +# endif + ) + { + if (error(!remove_directory(p), p, ec, "boost::filesystem::remove")) + return false; + } + else + { + if (error(!remove_file(p), p, ec, "boost::filesystem::remove")) + return false; + } + return true; + } + + boost::uintmax_t remove_all_aux(const path& p, fs::file_type type, + error_code* ec) + { + boost::uintmax_t count = 1; + + if (type == fs::directory_file) // but not a directory symlink + { + for (fs::directory_iterator itr(p); + itr != end_dir_itr; ++itr) + { + fs::file_type tmp_type = query_file_type(itr->path(), ec); + if (ec != 0 && *ec) + return count; + count += remove_all_aux(itr->path(), tmp_type, ec); + } + } + remove_file_or_directory(p, type, ec); + return count; + } + +#ifdef BOOST_POSIX_API + +//--------------------------------------------------------------------------------------// +// // +// POSIX-specific helpers // +// // +//--------------------------------------------------------------------------------------// + + const char dot = '.'; + + bool not_found_error(int errval) + { + return errno == ENOENT || errno == ENOTDIR; + } + + bool // true if ok + copy_file_api(const std::string& from_p, + const std::string& to_p, bool fail_if_exists) + { + const std::size_t buf_sz = 32768; + boost::scoped_array<char> buf(new char [buf_sz]); + int infile=-1, outfile=-1; // -1 means not open + + // bug fixed: code previously did a stat()on the from_file first, but that + // introduced a gratuitous race condition; the stat()is now done after the open() + + if ((infile = ::open(from_p.c_str(), O_RDONLY))< 0) + { return false; } + + struct stat from_stat; + if (::stat(from_p.c_str(), &from_stat)!= 0) + { + ::close(infile); + return false; + } + + int oflag = O_CREAT | O_WRONLY | O_TRUNC; + if (fail_if_exists) + oflag |= O_EXCL; + if ((outfile = ::open(to_p.c_str(), oflag, from_stat.st_mode))< 0) + { + int open_errno = errno; + BOOST_ASSERT(infile >= 0); + ::close(infile); + errno = open_errno; + return false; + } + + ssize_t sz, sz_read=1, sz_write; + while (sz_read > 0 + && (sz_read = ::read(infile, buf.get(), buf_sz))> 0) + { + // Allow for partial writes - see Advanced Unix Programming (2nd Ed.), + // Marc Rochkind, Addison-Wesley, 2004, page 94 + sz_write = 0; + do + { + if ((sz = ::write(outfile, buf.get() + sz_write, + sz_read - sz_write))< 0) + { + sz_read = sz; // cause read loop termination + break; // and error to be thrown after closes + } + sz_write += sz; + } while (sz_write < sz_read); + } + + if (::close(infile)< 0)sz_read = -1; + if (::close(outfile)< 0)sz_read = -1; + + return sz_read >= 0; + } + + inline fs::file_type query_file_type(const path& p, error_code* ec) + { + return fs::detail::symlink_status(p, ec).type(); + } + +# else + +//--------------------------------------------------------------------------------------// +// // +// Windows-specific helpers // +// // +//--------------------------------------------------------------------------------------// + + const wchar_t dot = L'.'; + + bool not_found_error(int errval) + { + return errval == ERROR_FILE_NOT_FOUND + || errval == ERROR_PATH_NOT_FOUND + || errval == ERROR_INVALID_NAME // "tools/jam/src/:sys:stat.h", "//foo" + || errval == ERROR_INVALID_DRIVE // USB card reader with no card inserted + || errval == ERROR_NOT_READY // CD/DVD drive with no disc inserted + || errval == ERROR_INVALID_PARAMETER // ":sys:stat.h" + || errval == ERROR_BAD_PATHNAME // "//nosuch" on Win64 + || errval == ERROR_BAD_NETPATH; // "//nosuch" on Win32 + } + +// some distributions of mingw as early as GLIBCXX__ 20110325 have _stricmp, but the +// offical 4.6.2 release with __GLIBCXX__ 20111026 doesn't. Play it safe for now, and +// only use _stricmp if _MSC_VER is defined +#if defined(_MSC_VER) // || (defined(__GLIBCXX__) && __GLIBCXX__ >= 20110325) +# define BOOST_FILESYSTEM_STRICMP _stricmp +#else +# define BOOST_FILESYSTEM_STRICMP strcmp +#endif + + perms make_permissions(const path& p, DWORD attr) + { + perms prms = fs::owner_read | fs::group_read | fs::others_read; + if ((attr & FILE_ATTRIBUTE_READONLY) == 0) + prms |= fs::owner_write | fs::group_write | fs::others_write; + if (BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".exe") == 0 + || BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".com") == 0 + || BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".bat") == 0 + || BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".cmd") == 0) + prms |= fs::owner_exe | fs::group_exe | fs::others_exe; + return prms; + } + + // these constants come from inspecting some Microsoft sample code + std::time_t to_time_t(const FILETIME & ft) + { + __int64 t = (static_cast<__int64>(ft.dwHighDateTime)<< 32) + + ft.dwLowDateTime; +# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // > VC++ 7.0 + t -= 116444736000000000LL; +# else + t -= 116444736000000000; +# endif + t /= 10000000; + return static_cast<std::time_t>(t); + } + + void to_FILETIME(std::time_t t, FILETIME & ft) + { + __int64 temp = t; + temp *= 10000000; +# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // > VC++ 7.0 + temp += 116444736000000000LL; +# else + temp += 116444736000000000; +# endif + ft.dwLowDateTime = static_cast<DWORD>(temp); + ft.dwHighDateTime = static_cast<DWORD>(temp >> 32); + } + + // Thanks to Jeremy Maitin-Shepard for much help and for permission to + // base the equivalent()implementation on portions of his + // file-equivalence-win32.cpp experimental code. + + struct handle_wrapper + { + HANDLE handle; + handle_wrapper(HANDLE h) + : handle(h){} + ~handle_wrapper() + { + if (handle != INVALID_HANDLE_VALUE) + ::CloseHandle(handle); + } + }; + + HANDLE create_file_handle(const path& p, DWORD dwDesiredAccess, + DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, + HANDLE hTemplateFile) + { + return ::CreateFileW(p.c_str(), dwDesiredAccess, dwShareMode, + lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, + hTemplateFile); + } + + bool is_reparse_point_a_symlink(const path& p) + { + handle_wrapper h(create_file_handle(p, FILE_READ_EA, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, NULL)); + if (h.handle == INVALID_HANDLE_VALUE) + return false; + + boost::scoped_array<char> buf(new char [MAXIMUM_REPARSE_DATA_BUFFER_SIZE]); + + // Query the reparse data + DWORD dwRetLen; + BOOL result = ::DeviceIoControl(h.handle, FSCTL_GET_REPARSE_POINT, NULL, 0, buf.get(), + MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &dwRetLen, NULL); + if (!result) return false; + + return reinterpret_cast<const REPARSE_DATA_BUFFER*>(buf.get()) + ->ReparseTag == IO_REPARSE_TAG_SYMLINK; + } + + inline std::size_t get_full_path_name( + const path& src, std::size_t len, wchar_t* buf, wchar_t** p) + { + return static_cast<std::size_t>( + ::GetFullPathNameW(src.c_str(), static_cast<DWORD>(len), buf, p)); + } + + fs::file_status process_status_failure(const path& p, error_code* ec) + { + int errval(::GetLastError()); + if (ec != 0) // always report errval, even though some + ec->assign(errval, system_category()); // errval values are not status_errors + + if (not_found_error(errval)) + { + return fs::file_status(fs::file_not_found, fs::no_perms); + } + else if ((errval == ERROR_SHARING_VIOLATION)) + { + return fs::file_status(fs::type_unknown); + } + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status", + p, error_code(errval, system_category()))); + return fs::file_status(fs::status_error); + } + + // differs from symlink_status() in that directory symlinks are reported as + // _detail_directory_symlink, as required on Windows by remove() and its helpers. + fs::file_type query_file_type(const path& p, error_code* ec) + { + DWORD attr(::GetFileAttributesW(p.c_str())); + if (attr == 0xFFFFFFFF) + { + return process_status_failure(p, ec).type(); + } + + if (ec != 0) ec->clear(); + + if (attr & FILE_ATTRIBUTE_REPARSE_POINT) + { + if (is_reparse_point_a_symlink(p)) + return (attr & FILE_ATTRIBUTE_DIRECTORY) + ? fs::_detail_directory_symlink + : fs::symlink_file; + return fs::reparse_file; + } + + return (attr & FILE_ATTRIBUTE_DIRECTORY) + ? fs::directory_file + : fs::regular_file; + } + + BOOL resize_file_api(const wchar_t* p, boost::uintmax_t size) + { + HANDLE handle = CreateFileW(p, GENERIC_WRITE, 0, 0, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, 0); + LARGE_INTEGER sz; + sz.QuadPart = size; + return handle != INVALID_HANDLE_VALUE + && ::SetFilePointerEx(handle, sz, 0, FILE_BEGIN) + && ::SetEndOfFile(handle) + && ::CloseHandle(handle); + } + + // Windows kernel32.dll functions that may or may not be present + // must be accessed through pointers + + typedef BOOL (WINAPI *PtrCreateHardLinkW)( + /*__in*/ LPCWSTR lpFileName, + /*__in*/ LPCWSTR lpExistingFileName, + /*__reserved*/ LPSECURITY_ATTRIBUTES lpSecurityAttributes + ); + + PtrCreateHardLinkW create_hard_link_api = PtrCreateHardLinkW( + ::GetProcAddress( + ::GetModuleHandle(TEXT("kernel32.dll")), "CreateHardLinkW")); + + typedef BOOLEAN (WINAPI *PtrCreateSymbolicLinkW)( + /*__in*/ LPCWSTR lpSymlinkFileName, + /*__in*/ LPCWSTR lpTargetFileName, + /*__in*/ DWORD dwFlags + ); + + PtrCreateSymbolicLinkW create_symbolic_link_api = PtrCreateSymbolicLinkW( + ::GetProcAddress( + ::GetModuleHandle(TEXT("kernel32.dll")), "CreateSymbolicLinkW")); + +#endif + +//#ifdef BOOST_WINDOWS_API +// +// +// inline bool get_free_disk_space(const std::wstring& ph, +// PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free) +// { return ::GetDiskFreeSpaceExW(ph.c_str(), avail, total, free)!= 0; } +// +//#endif + +} // unnamed namespace + +//--------------------------------------------------------------------------------------// +// // +// operations functions declared in operations.hpp // +// in alphabetic order // +// // +//--------------------------------------------------------------------------------------// + +namespace boost +{ +namespace filesystem3 +{ + + BOOST_FILESYSTEM_DECL + path absolute(const path& p, const path& base) + { +// if ( p.empty() || p.is_absolute() ) +// return p; +// // recursively calling absolute is sub-optimal, but is simple +// path abs_base(base.is_absolute() ? base : absolute(base)); +//# ifdef BOOST_WINDOWS_API +// if (p.has_root_directory()) +// return abs_base.root_name() / p; +// // !p.has_root_directory +// if (p.has_root_name()) +// return p.root_name() +// / abs_base.root_directory() / abs_base.relative_path() / p.relative_path(); +// // !p.has_root_name() +//# endif +// return abs_base / p; + + // recursively calling absolute is sub-optimal, but is sure and simple + path abs_base(base.is_absolute() ? base : absolute(base)); + + // store expensive to compute values that are needed multiple times + path p_root_name (p.root_name()); + path base_root_name (abs_base.root_name()); + path p_root_directory (p.root_directory()); + + if (p.empty()) + return abs_base; + + if (!p_root_name.empty()) // p.has_root_name() + { + if (p_root_directory.empty()) // !p.has_root_directory() + return p_root_name / abs_base.root_directory() + / abs_base.relative_path() / p.relative_path(); + // p is absolute, so fall through to return p at end of block + } + + else if (!p_root_directory.empty()) // p.has_root_directory() + { +# ifdef BOOST_POSIX_API + // POSIX can have root name it it is a network path + if (base_root_name.empty()) // !abs_base.has_root_name() + return p; +# endif + return base_root_name / p; + } + + else + { + return abs_base / p; + } + + return p; // p.is_absolute() is true + } + +namespace detail +{ + BOOST_FILESYSTEM_DECL bool possible_large_file_size_support() + { +# ifdef BOOST_POSIX_API + struct stat lcl_stat; + return sizeof(lcl_stat.st_size)> 4; +# else + return true; +# endif + } + + BOOST_FILESYSTEM_DECL + path canonical(const path& p, const path& base, system::error_code* ec) + { + path source (p.is_absolute() ? p : absolute(p, base)); + path result; + + system::error_code local_ec; + file_status stat (status(source, local_ec)); + + if (stat.type() == fs::file_not_found) + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error( + "boost::filesystem::canonical", source, + error_code(system::errc::no_such_file_or_directory, system::generic_category()))); + ec->assign(system::errc::no_such_file_or_directory, system::generic_category()); + return result; + } + else if (local_ec) + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error( + "boost::filesystem::canonical", source, local_ec)); + *ec = local_ec; + return result; + } + + bool scan (true); + while (scan) + { + scan = false; + result.clear(); + for (path::iterator itr = source.begin(); itr != source.end(); ++itr) + { + if (*itr == dot_path) + continue; + if (*itr == dot_dot_path) + { + result.remove_filename(); + continue; + } + + result /= *itr; + + bool is_sym (is_symlink(detail::symlink_status(result, ec))); + if (ec && *ec) + return path(); + + if (is_sym) + { + path link(detail::read_symlink(result, ec)); + if (ec && *ec) + return path(); + result.remove_filename(); + + if (link.is_absolute()) + { + for (++itr; itr != source.end(); ++itr) + link /= *itr; + source = link; + } + else // link is relative + { + path new_source(result); + new_source /= link; + for (++itr; itr != source.end(); ++itr) + new_source /= *itr; + source = new_source; + } + scan = true; // symlink causes scan to be restarted + break; + } + } + } + if (ec != 0) + ec->clear(); + BOOST_ASSERT_MSG(result.is_absolute(), "canonical() implementation error; please report"); + return result; + } + + BOOST_FILESYSTEM_DECL + void copy(const path& from, const path& to, system::error_code* ec) + { + file_status s(symlink_status(from, *ec)); + if (ec != 0 && *ec) return; + + if(is_symlink(s)) + { + copy_symlink(from, to, *ec); + } + else if(is_directory(s)) + { + copy_directory(from, to, *ec); + } + else if(is_regular_file(s)) + { + copy_file(from, to, copy_option::fail_if_exists, *ec); + } + else + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::copy", + from, to, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()))); + ec->assign(BOOST_ERROR_NOT_SUPPORTED, system_category()); + } + } + + BOOST_FILESYSTEM_DECL + void copy_directory(const path& from, const path& to, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + struct stat from_stat; +# endif + error(!BOOST_COPY_DIRECTORY(from.c_str(), to.c_str()), + from, to, ec, "boost::filesystem::copy_directory"); + } + + BOOST_FILESYSTEM_DECL + void copy_file(const path& from, const path& to, + BOOST_SCOPED_ENUM(copy_option)option, + error_code* ec) + { + error(!BOOST_COPY_FILE(from.c_str(), to.c_str(), + option == copy_option::fail_if_exists), + from, to, ec, "boost::filesystem::copy_file"); + } + + BOOST_FILESYSTEM_DECL + void copy_symlink(const path& existing_symlink, const path& new_symlink, + system::error_code* ec) + { +# if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600 + error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), + new_symlink, existing_symlink, ec, + "boost::filesystem::copy_symlink"); + +# else // modern Windows or BOOST_POSIX_API + path p(read_symlink(existing_symlink, ec)); + if (ec != 0 && *ec) return; + create_symlink(p, new_symlink, ec); + +# endif + } + + BOOST_FILESYSTEM_DECL + bool create_directories(const path& p, system::error_code* ec) + { + if (p.empty() || exists(p)) + { + if (!p.empty() && !is_directory(p)) + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error( + "boost::filesystem::create_directories", p, + error_code(system::errc::file_exists, system::generic_category()))); + else ec->assign(system::errc::file_exists, system::generic_category()); + } + return false; + } + + // First create branch, by calling ourself recursively + create_directories(p.parent_path(), ec); + // Now that parent's path exists, create the directory + create_directory(p, ec); + return true; + } + + BOOST_FILESYSTEM_DECL + bool create_directory(const path& p, error_code* ec) + { + if (BOOST_CREATE_DIRECTORY(p.c_str())) + { + if (ec != 0) ec->clear(); + return true; + } + + // attempt to create directory failed + int errval(BOOST_ERRNO); // save reason for failure + error_code dummy; + if (errval == BOOST_ERROR_ALREADY_EXISTS && is_directory(p, dummy)) + { + if (ec != 0) ec->clear(); + return false; + } + + // attempt to create directory failed && it doesn't already exist + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::create_directory", + p, error_code(errval, system_category()))); + else + ec->assign(errval, system_category()); + return false; + } + + BOOST_FILESYSTEM_DECL + void create_directory_symlink(const path& to, const path& from, + system::error_code* ec) + { +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008 + + error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec, + "boost::filesystem::create_directory_symlink"); +# else + +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600 + // see if actually supported by Windows runtime dll + if (error(!create_symbolic_link_api, + error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), + to, from, ec, + "boost::filesystem::create_directory_symlink")) + return; +# endif + + error(!BOOST_CREATE_SYMBOLIC_LINK(from.c_str(), to.c_str(), SYMBOLIC_LINK_FLAG_DIRECTORY), + to, from, ec, "boost::filesystem::create_directory_symlink"); +# endif + } + + BOOST_FILESYSTEM_DECL + void create_hard_link(const path& to, const path& from, error_code* ec) + { + +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0500 // SDK earlier than Win 2K + + error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec, + "boost::filesystem::create_hard_link"); +# else + +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0500 + // see if actually supported by Windows runtime dll + if (error(!create_hard_link_api, + error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), + to, from, ec, + "boost::filesystem::create_hard_link")) + return; +# endif + + error(!BOOST_CREATE_HARD_LINK(from.c_str(), to.c_str()), to, from, ec, + "boost::filesystem::create_hard_link"); +# endif + } + + BOOST_FILESYSTEM_DECL + void create_symlink(const path& to, const path& from, error_code* ec) + { +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008 + error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec, + "boost::filesystem::create_directory_symlink"); +# else + +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600 + // see if actually supported by Windows runtime dll + if (error(!create_symbolic_link_api, + error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), + to, from, ec, + "boost::filesystem::create_symlink")) + return; +# endif + + error(!BOOST_CREATE_SYMBOLIC_LINK(from.c_str(), to.c_str(), 0), + to, from, ec, "boost::filesystem::create_symlink"); +# endif + } + + BOOST_FILESYSTEM_DECL + path current_path(error_code* ec) + { +# ifdef BOOST_POSIX_API + path cur; + for (long path_max = 128;; path_max *=2)// loop 'til buffer large enough + { + boost::scoped_array<char> + buf(new char[static_cast<std::size_t>(path_max)]); + if (::getcwd(buf.get(), static_cast<std::size_t>(path_max))== 0) + { + if (error(errno != ERANGE + // bug in some versions of the Metrowerks C lib on the Mac: wrong errno set +# if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) + && errno != 0 +# endif + , ec, "boost::filesystem::current_path")) + { + break; + } + } + else + { + cur = buf.get(); + if (ec != 0) ec->clear(); + break; + } + } + return cur; + +# else + DWORD sz; + if ((sz = ::GetCurrentDirectoryW(0, NULL))== 0)sz = 1; + boost::scoped_array<path::value_type> buf(new path::value_type[sz]); + error(::GetCurrentDirectoryW(sz, buf.get())== 0, ec, + "boost::filesystem::current_path"); + return path(buf.get()); +# endif + } + + + BOOST_FILESYSTEM_DECL + void current_path(const path& p, system::error_code* ec) + { + error(!BOOST_SET_CURRENT_DIRECTORY(p.c_str()), + p, ec, "boost::filesystem::current_path"); + } + + BOOST_FILESYSTEM_DECL + bool equivalent(const path& p1, const path& p2, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + struct stat s2; + int e2(::stat(p2.c_str(), &s2)); + struct stat s1; + int e1(::stat(p1.c_str(), &s1)); + + if (e1 != 0 || e2 != 0) + { + // if one is invalid and the other isn't then they aren't equivalent, + // but if both are invalid then it is an error + error (e1 != 0 && e2 != 0, p1, p2, ec, "boost::filesystem::equivalent"); + return false; + } + + // both stats now known to be valid + return s1.st_dev == s2.st_dev && s1.st_ino == s2.st_ino + // According to the POSIX stat specs, "The st_ino and st_dev fields + // taken together uniquely identify the file within the system." + // Just to be sure, size and mod time are also checked. + && s1.st_size == s2.st_size && s1.st_mtime == s2.st_mtime; + +# else // Windows + + // Note well: Physical location on external media is part of the + // equivalence criteria. If there are no open handles, physical location + // can change due to defragmentation or other relocations. Thus handles + // must be held open until location information for both paths has + // been retrieved. + + // p2 is done first, so any error reported is for p1 + handle_wrapper h2( + create_file_handle( + p2.c_str(), + 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + 0, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + 0)); + + handle_wrapper h1( + create_file_handle( + p1.c_str(), + 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + 0, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + 0)); + + if (h1.handle == INVALID_HANDLE_VALUE + || h2.handle == INVALID_HANDLE_VALUE) + { + // if one is invalid and the other isn't, then they aren't equivalent, + // but if both are invalid then it is an error + error(h1.handle == INVALID_HANDLE_VALUE + && h2.handle == INVALID_HANDLE_VALUE, p1, p2, ec, + "boost::filesystem::equivalent"); + return false; + } + + // at this point, both handles are known to be valid + + BY_HANDLE_FILE_INFORMATION info1, info2; + + if (error(!::GetFileInformationByHandle(h1.handle, &info1), + p1, p2, ec, "boost::filesystem::equivalent")) + return false; + + if (error(!::GetFileInformationByHandle(h2.handle, &info2), + p1, p2, ec, "boost::filesystem::equivalent")) + return false; + + // In theory, volume serial numbers are sufficient to distinguish between + // devices, but in practice VSN's are sometimes duplicated, so last write + // time and file size are also checked. + return + info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber + && info1.nFileIndexHigh == info2.nFileIndexHigh + && info1.nFileIndexLow == info2.nFileIndexLow + && info1.nFileSizeHigh == info2.nFileSizeHigh + && info1.nFileSizeLow == info2.nFileSizeLow + && info1.ftLastWriteTime.dwLowDateTime + == info2.ftLastWriteTime.dwLowDateTime + && info1.ftLastWriteTime.dwHighDateTime + == info2.ftLastWriteTime.dwHighDateTime; + +# endif + } + + BOOST_FILESYSTEM_DECL + boost::uintmax_t file_size(const path& p, error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (error(::stat(p.c_str(), &path_stat)!= 0, + p, ec, "boost::filesystem::file_size")) + return static_cast<boost::uintmax_t>(-1); + if (error(!S_ISREG(path_stat.st_mode), + error_code(EPERM, system_category()), + p, ec, "boost::filesystem::file_size")) + return static_cast<boost::uintmax_t>(-1); + + return static_cast<boost::uintmax_t>(path_stat.st_size); + +# else // Windows + + // assume uintmax_t is 64-bits on all Windows compilers + + WIN32_FILE_ATTRIBUTE_DATA fad; + + if (error(::GetFileAttributesExW(p.c_str(), ::GetFileExInfoStandard, &fad)== 0, + p, ec, "boost::filesystem::file_size")) + return static_cast<boost::uintmax_t>(-1); + + if (error((fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)!= 0, + error_code(ERROR_NOT_SUPPORTED, system_category()), + p, ec, "boost::filesystem::file_size")) + return static_cast<boost::uintmax_t>(-1); + + return (static_cast<boost::uintmax_t>(fad.nFileSizeHigh) + << (sizeof(fad.nFileSizeLow)*8)) + fad.nFileSizeLow; +# endif + } + + BOOST_FILESYSTEM_DECL + boost::uintmax_t hard_link_count(const path& p, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + return error(::stat(p.c_str(), &path_stat)!= 0, + p, ec, "boost::filesystem::hard_link_count") + ? 0 + : static_cast<boost::uintmax_t>(path_stat.st_nlink); + +# else // Windows + + // Link count info is only available through GetFileInformationByHandle + BY_HANDLE_FILE_INFORMATION info; + handle_wrapper h( + create_file_handle(p.c_str(), 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)); + return + !error(h.handle == INVALID_HANDLE_VALUE, + p, ec, "boost::filesystem::hard_link_count") + && !error(::GetFileInformationByHandle(h.handle, &info)== 0, + p, ec, "boost::filesystem::hard_link_count") + ? info.nNumberOfLinks + : 0; +# endif + } + + BOOST_FILESYSTEM_DECL + path initial_path(error_code* ec) + { + static path init_path; + if (init_path.empty()) + init_path = current_path(ec); + else if (ec != 0) ec->clear(); + return init_path; + } + + BOOST_FILESYSTEM_DECL + bool is_empty(const path& p, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (error(::stat(p.c_str(), &path_stat)!= 0, + p, ec, "boost::filesystem::is_empty")) + return false; + return S_ISDIR(path_stat.st_mode) + ? is_empty_directory(p) + : path_stat.st_size == 0; +# else + + WIN32_FILE_ATTRIBUTE_DATA fad; + if (error(::GetFileAttributesExW(p.c_str(), ::GetFileExInfoStandard, &fad)== 0, + p, ec, "boost::filesystem::is_empty")) + return false; + + if (ec != 0) ec->clear(); + return + (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + ? is_empty_directory(p) + : (!fad.nFileSizeHigh && !fad.nFileSizeLow); +# endif + } + + BOOST_FILESYSTEM_DECL + std::time_t last_write_time(const path& p, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (error(::stat(p.c_str(), &path_stat)!= 0, + p, ec, "boost::filesystem::last_write_time")) + return std::time_t(-1); + return path_stat.st_mtime; + +# else + + handle_wrapper hw( + create_file_handle(p.c_str(), 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)); + + if (error(hw.handle == INVALID_HANDLE_VALUE, + p, ec, "boost::filesystem::last_write_time")) + return std::time_t(-1); + + FILETIME lwt; + + if (error(::GetFileTime(hw.handle, 0, 0, &lwt)== 0, + p, ec, "boost::filesystem::last_write_time")) + return std::time_t(-1); + + return to_time_t(lwt); +# endif + } + + BOOST_FILESYSTEM_DECL + void last_write_time(const path& p, const std::time_t new_time, + system::error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (error(::stat(p.c_str(), &path_stat)!= 0, + p, ec, "boost::filesystem::last_write_time")) + return; + ::utimbuf buf; + buf.actime = path_stat.st_atime; // utime()updates access time too:-( + buf.modtime = new_time; + error(::utime(p.c_str(), &buf)!= 0, + p, ec, "boost::filesystem::last_write_time"); + +# else + + handle_wrapper hw( + create_file_handle(p.c_str(), FILE_WRITE_ATTRIBUTES, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)); + + if (error(hw.handle == INVALID_HANDLE_VALUE, + p, ec, "boost::filesystem::last_write_time")) + return; + + FILETIME lwt; + to_FILETIME(new_time, lwt); + + error(::SetFileTime(hw.handle, 0, 0, &lwt)== 0, + p, ec, "boost::filesystem::last_write_time"); +# endif + } + +# ifdef BOOST_POSIX_API + const perms active_bits(all_all | set_uid_on_exe | set_gid_on_exe | sticky_bit); + inline mode_t mode_cast(perms prms) { return prms & active_bits; } +# endif + + BOOST_FILESYSTEM_DECL + void permissions(const path& p, perms prms, system::error_code* ec) + { + BOOST_ASSERT_MSG(!((prms & add_perms) && (prms & remove_perms)), + "add_perms and remove_perms are mutually exclusive"); + + if ((prms & add_perms) && (prms & remove_perms)) // precondition failed + return; + +# ifdef BOOST_POSIX_API + error_code local_ec; + file_status current_status((prms & symlink_perms) + ? fs::symlink_status(p, local_ec) + : fs::status(p, local_ec)); + if (local_ec) + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error( + "boost::filesystem::permissions", p, local_ec)); + else + *ec = local_ec; + return; + } + + if (prms & add_perms) + prms |= current_status.permissions(); + else if (prms & remove_perms) + prms = current_status.permissions() & ~prms; + + // Mac OS X Lion and some other platforms don't support fchmodat() +# if defined(AT_FDCWD) && defined(AT_SYMLINK_NOFOLLOW) \ + && (!defined(__SUNPRO_CC) || __SUNPRO_CC > 0x5100) + if (::fchmodat(AT_FDCWD, p.c_str(), mode_cast(prms), + !(prms & symlink_perms) ? 0 : AT_SYMLINK_NOFOLLOW)) +# else // fallback if fchmodat() not supported + if (::chmod(p.c_str(), mode_cast(prms))) +# endif + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error( + "boost::filesystem::permissions", p, + error_code(errno, system::generic_category()))); + else + ec->assign(errno, system::generic_category()); + } + +# else // Windows + + // if not going to alter FILE_ATTRIBUTE_READONLY, just return + if (!(!((prms & (add_perms | remove_perms))) + || (prms & (owner_write|group_write|others_write)))) + return; + + DWORD attr = ::GetFileAttributesW(p.c_str()); + + if (error(attr == 0, p, ec, "boost::filesystem::permissions")) + return; + + if (prms & add_perms) + attr &= ~FILE_ATTRIBUTE_READONLY; + else if (prms & remove_perms) + attr |= FILE_ATTRIBUTE_READONLY; + else if (prms & (owner_write|group_write|others_write)) + attr &= ~FILE_ATTRIBUTE_READONLY; + else + attr |= FILE_ATTRIBUTE_READONLY; + + error(::SetFileAttributesW(p.c_str(), attr) == 0, + p, ec, "boost::filesystem::permissions"); +# endif + } + + BOOST_FILESYSTEM_DECL + path read_symlink(const path& p, system::error_code* ec) + { + path symlink_path; + +# ifdef BOOST_POSIX_API + + for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer large enough + { + boost::scoped_array<char> buf(new char[path_max]); + ssize_t result; + if ((result=::readlink(p.c_str(), buf.get(), path_max))== -1) + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::read_symlink", + p, error_code(errno, system_category()))); + else ec->assign(errno, system_category()); + break; + } + else + { + if(result != static_cast<ssize_t>(path_max)) + { + symlink_path.assign(buf.get(), buf.get() + result); + if (ec != 0) ec->clear(); + break; + } + } + } + +# elif _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008 + error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), p, ec, + "boost::filesystem::read_symlink"); +# else // Vista and Server 2008 SDK, or later + + union info_t + { + char buf[REPARSE_DATA_BUFFER_HEADER_SIZE+MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; + REPARSE_DATA_BUFFER rdb; + } info; + + handle_wrapper h( + create_file_handle(p.c_str(), GENERIC_READ, 0, 0, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0)); + + if (error(h.handle == INVALID_HANDLE_VALUE, p, ec, "boost::filesystem::read_symlink")) + return symlink_path; + + DWORD sz; + + if (!error(::DeviceIoControl(h.handle, FSCTL_GET_REPARSE_POINT, + 0, 0, info.buf, sizeof(info), &sz, 0) == 0, p, ec, + "boost::filesystem::read_symlink" )) + symlink_path.assign( + static_cast<wchar_t*>(info.rdb.SymbolicLinkReparseBuffer.PathBuffer) + + info.rdb.SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(wchar_t), + static_cast<wchar_t*>(info.rdb.SymbolicLinkReparseBuffer.PathBuffer) + + info.rdb.SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(wchar_t) + + info.rdb.SymbolicLinkReparseBuffer.PrintNameLength/sizeof(wchar_t)); +# endif + return symlink_path; + } + + BOOST_FILESYSTEM_DECL + bool remove(const path& p, error_code* ec) + { + error_code tmp_ec; + file_type type = query_file_type(p, &tmp_ec); + if (error(type == status_error, tmp_ec, p, ec, + "boost::filesystem::remove")) + return false; + + // Since POSIX remove() is specified to work with either files or directories, in a + // perfect world it could just be called. But some important real-world operating + // systems (Windows, Mac OS X, for example) don't implement the POSIX spec. So + // remove_file_or_directory() is always called to kep it simple. + return remove_file_or_directory(p, type, ec); + } + + BOOST_FILESYSTEM_DECL + boost::uintmax_t remove_all(const path& p, error_code* ec) + { + error_code tmp_ec; + file_type type = query_file_type(p, &tmp_ec); + if (error(type == status_error, tmp_ec, p, ec, + "boost::filesystem::remove_all")) + return 0; + + return (type != status_error && type != file_not_found) // exists + ? remove_all_aux(p, type, ec) + : 0; + } + + BOOST_FILESYSTEM_DECL + void rename(const path& old_p, const path& new_p, error_code* ec) + { + error(!BOOST_MOVE_FILE(old_p.c_str(), new_p.c_str()), old_p, new_p, ec, + "boost::filesystem::rename"); + } + + BOOST_FILESYSTEM_DECL + void resize_file(const path& p, uintmax_t size, system::error_code* ec) + { + error(!BOOST_RESIZE_FILE(p.c_str(), size), p, ec, "boost::filesystem::resize_file"); + } + + BOOST_FILESYSTEM_DECL + space_info space(const path& p, error_code* ec) + { +# ifdef BOOST_POSIX_API + struct BOOST_STATVFS vfs; + space_info info; + if (!error(::BOOST_STATVFS(p.c_str(), &vfs)!= 0, + p, ec, "boost::filesystem::space")) + { + info.capacity + = static_cast<boost::uintmax_t>(vfs.f_blocks)* BOOST_STATVFS_F_FRSIZE; + info.free + = static_cast<boost::uintmax_t>(vfs.f_bfree)* BOOST_STATVFS_F_FRSIZE; + info.available + = static_cast<boost::uintmax_t>(vfs.f_bavail)* BOOST_STATVFS_F_FRSIZE; + } + +# else + ULARGE_INTEGER avail, total, free; + space_info info; + + if (!error(::GetDiskFreeSpaceExW(p.c_str(), &avail, &total, &free)== 0, + p, ec, "boost::filesystem::space")) + { + info.capacity + = (static_cast<boost::uintmax_t>(total.HighPart)<< 32) + + total.LowPart; + info.free + = (static_cast<boost::uintmax_t>(free.HighPart)<< 32) + + free.LowPart; + info.available + = (static_cast<boost::uintmax_t>(avail.HighPart)<< 32) + + avail.LowPart; + } + +# endif + + else + { + info.capacity = info.free = info.available = 0; + } + return info; + } + + BOOST_FILESYSTEM_DECL + file_status status(const path& p, error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (::stat(p.c_str(), &path_stat)!= 0) + { + if (ec != 0) // always report errno, even though some + ec->assign(errno, system_category()); // errno values are not status_errors + + if (not_found_error(errno)) + { + return fs::file_status(fs::file_not_found, fs::no_perms); + } + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status", + p, error_code(errno, system_category()))); + return fs::file_status(fs::status_error); + } + if (ec != 0) ec->clear();; + if (S_ISDIR(path_stat.st_mode)) + return fs::file_status(fs::directory_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISREG(path_stat.st_mode)) + return fs::file_status(fs::regular_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISBLK(path_stat.st_mode)) + return fs::file_status(fs::block_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISCHR(path_stat.st_mode)) + return fs::file_status(fs::character_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISFIFO(path_stat.st_mode)) + return fs::file_status(fs::fifo_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISSOCK(path_stat.st_mode)) + return fs::file_status(fs::socket_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + return fs::file_status(fs::type_unknown); + +# else // Windows + + DWORD attr(::GetFileAttributesW(p.c_str())); + if (attr == 0xFFFFFFFF) + { + return process_status_failure(p, ec); + } + + // reparse point handling; + // since GetFileAttributesW does not resolve symlinks, try to open a file + // handle to discover if the file exists + if (attr & FILE_ATTRIBUTE_REPARSE_POINT) + { + handle_wrapper h( + create_file_handle( + p.c_str(), + 0, // dwDesiredAccess; attributes only + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + 0, // lpSecurityAttributes + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + 0)); // hTemplateFile + if (h.handle == INVALID_HANDLE_VALUE) + { + return process_status_failure(p, ec); + } + + if (!is_reparse_point_a_symlink(p)) + return file_status(reparse_file, make_permissions(p, attr)); + } + + if (ec != 0) ec->clear(); + return (attr & FILE_ATTRIBUTE_DIRECTORY) + ? file_status(directory_file, make_permissions(p, attr)) + : file_status(regular_file, make_permissions(p, attr)); + +# endif + } + + BOOST_FILESYSTEM_DECL + file_status symlink_status(const path& p, error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (::lstat(p.c_str(), &path_stat)!= 0) + { + if (ec != 0) // always report errno, even though some + ec->assign(errno, system_category()); // errno values are not status_errors + + if (errno == ENOENT || errno == ENOTDIR) // these are not errors + { + return fs::file_status(fs::file_not_found, fs::no_perms); + } + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status", + p, error_code(errno, system_category()))); + return fs::file_status(fs::status_error); + } + if (ec != 0) ec->clear(); + if (S_ISREG(path_stat.st_mode)) + return fs::file_status(fs::regular_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISDIR(path_stat.st_mode)) + return fs::file_status(fs::directory_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISLNK(path_stat.st_mode)) + return fs::file_status(fs::symlink_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISBLK(path_stat.st_mode)) + return fs::file_status(fs::block_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISCHR(path_stat.st_mode)) + return fs::file_status(fs::character_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISFIFO(path_stat.st_mode)) + return fs::file_status(fs::fifo_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISSOCK(path_stat.st_mode)) + return fs::file_status(fs::socket_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + return fs::file_status(fs::type_unknown); + +# else // Windows + + DWORD attr(::GetFileAttributesW(p.c_str())); + if (attr == 0xFFFFFFFF) + { + return process_status_failure(p, ec); + } + + if (ec != 0) ec->clear(); + + if (attr & FILE_ATTRIBUTE_REPARSE_POINT) + return is_reparse_point_a_symlink(p) + ? file_status(symlink_file, make_permissions(p, attr)) + : file_status(reparse_file, make_permissions(p, attr)); + + return (attr & FILE_ATTRIBUTE_DIRECTORY) + ? file_status(directory_file, make_permissions(p, attr)) + : file_status(regular_file, make_permissions(p, attr)); + +# endif + } + + // contributed by Jeff Flinn + BOOST_FILESYSTEM_DECL + path temp_directory_path(system::error_code* ec) + { +# ifdef BOOST_POSIX_API + const char* val = 0; + + (val = std::getenv("TMPDIR" )) || + (val = std::getenv("TMP" )) || + (val = std::getenv("TEMP" )) || + (val = std::getenv("TEMPDIR")); + + path p((val!=0) ? val : "/tmp"); + + if (p.empty() || (ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p))) + { + errno = ENOTDIR; + error(true, p, ec, "boost::filesystem::temp_directory_path"); + return p; + } + + return p; + +# else // Windows + + std::vector<path::value_type> buf(GetTempPathW(0, NULL)); + + if (buf.empty() || GetTempPathW(buf.size(), &buf[0])==0) + { + if(!buf.empty()) ::SetLastError(ENOTDIR); + error(true, ec, "boost::filesystem::temp_directory_path"); + return path(); + } + + buf.pop_back(); + + path p(buf.begin(), buf.end()); + + if ((ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p))) + { + ::SetLastError(ENOTDIR); + error(true, p, ec, "boost::filesystem::temp_directory_path"); + return path(); + } + + return p; +# endif + } + + BOOST_FILESYSTEM_DECL + path system_complete(const path& p, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + return (p.empty() || p.is_absolute()) + ? p : current_path()/ p; + +# else + if (p.empty()) + { + if (ec != 0) ec->clear(); + return p; + } + wchar_t buf[buf_size]; + wchar_t* pfn; + std::size_t len = get_full_path_name(p, buf_size, buf, &pfn); + + if (error(len == 0, p, ec, "boost::filesystem::system_complete")) + return path(); + + if (len < buf_size)// len does not include null termination character + return path(&buf[0]); + + boost::scoped_array<wchar_t> big_buf(new wchar_t[len]); + + return error(get_full_path_name(p, len , big_buf.get(), &pfn)== 0, + p, ec, "boost::filesystem::system_complete") + ? path() + : path(big_buf.get()); +# endif + } + +} // namespace detail + +//--------------------------------------------------------------------------------------// +// // +// directory_entry // +// // +//--------------------------------------------------------------------------------------// + + file_status + directory_entry::m_get_status(system::error_code* ec) const + { + if (!status_known(m_status)) + { + // optimization: if the symlink status is known, and it isn't a symlink, + // then status and symlink_status are identical so just copy the + // symlink status to the regular status. + if (status_known(m_symlink_status) + && !is_symlink(m_symlink_status)) + { + m_status = m_symlink_status; + if (ec != 0) ec->clear(); + } + else m_status = detail::status(m_path, ec); + } + else if (ec != 0) ec->clear(); + return m_status; + } + + file_status + directory_entry::m_get_symlink_status(system::error_code* ec) const + { + if (!status_known(m_symlink_status)) + m_symlink_status = detail::symlink_status(m_path, ec); + else if (ec != 0) ec->clear(); + return m_symlink_status; + } + +// dispatch directory_entry supplied here rather than in +// <boost/filesystem/path_traits.hpp>, thus avoiding header circularity. +// test cases are in operations_unit_test.cpp + +namespace path_traits +{ + void dispatch(const directory_entry & de, +# ifdef BOOST_WINDOWS_API + std::wstring& to, +# else + std::string& to, +# endif + const codecvt_type &) + { + to = de.path().native(); + } + +} // namespace path_traits +} // namespace filesystem3 +} // namespace boost + +//--------------------------------------------------------------------------------------// +// // +// directory_iterator // +// // +//--------------------------------------------------------------------------------------// + +namespace +{ +# ifdef BOOST_POSIX_API + + error_code path_max(std::size_t & result) + // this code is based on Stevens and Rago, Advanced Programming in the + // UNIX envirnment, 2nd Ed., ISBN 0-201-43307-9, page 49 + { +# ifdef PATH_MAX + static std::size_t max = PATH_MAX; +# else + static std::size_t max = 0; +# endif + if (max == 0) + { + errno = 0; + long tmp = ::pathconf("/", _PC_NAME_MAX); + if (tmp < 0) + { + if (errno == 0)// indeterminate + max = 4096; // guess + else return error_code(errno, system_category()); + } + else max = static_cast<std::size_t>(tmp + 1); // relative root + } + result = max; + return ok; + } + +#if defined(__PGI) && defined(__USE_FILE_OFFSET64) +#define dirent dirent64 +#endif + + error_code dir_itr_first(void *& handle, void *& buffer, + const char* dir, string& target, + fs::file_status &, fs::file_status &) + { + if ((handle = ::opendir(dir))== 0) + return error_code(errno, system_category()); + target = string("."); // string was static but caused trouble + // when iteration called from dtor, after + // static had already been destroyed + std::size_t path_size (0); // initialization quiets gcc warning (ticket #3509) + error_code ec = path_max(path_size); + if (ec)return ec; + dirent de; + buffer = std::malloc((sizeof(dirent) - sizeof(de.d_name)) + + path_size + 1); // + 1 for "/0" + return ok; + } + + // warning: the only dirent member updated is d_name + inline int readdir_r_simulator(DIR * dirp, struct dirent * entry, + struct dirent ** result)// *result set to 0 on end of directory + { + errno = 0; + +# if !defined(__CYGWIN__)\ + && defined(_POSIX_THREAD_SAFE_FUNCTIONS)\ + && defined(_SC_THREAD_SAFE_FUNCTIONS)\ + && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0)\ + && (!defined(__hpux) || defined(_REENTRANT)) \ + && (!defined(_AIX) || defined(__THREAD_SAFE)) + if (::sysconf(_SC_THREAD_SAFE_FUNCTIONS)>= 0) + { return ::readdir_r(dirp, entry, result); } +# endif + + struct dirent * p; + *result = 0; + if ((p = ::readdir(dirp))== 0) + return errno; + std::strcpy(entry->d_name, p->d_name); + *result = entry; + return 0; + } + + error_code dir_itr_increment(void *& handle, void *& buffer, + string& target, fs::file_status & sf, fs::file_status & symlink_sf) + { + BOOST_ASSERT(buffer != 0); + dirent * entry(static_cast<dirent *>(buffer)); + dirent * result; + int return_code; + if ((return_code = readdir_r_simulator(static_cast<DIR*>(handle), entry, &result))!= 0) + return error_code(errno, system_category()); + if (result == 0) + return fs::detail::dir_itr_close(handle, buffer); + target = entry->d_name; +# ifdef BOOST_FILESYSTEM_STATUS_CACHE + if (entry->d_type == DT_UNKNOWN) // filesystem does not supply d_type value + { + sf = symlink_sf = fs::file_status(fs::status_error); + } + else // filesystem supplies d_type value + { + if (entry->d_type == DT_DIR) + sf = symlink_sf = fs::file_status(fs::directory_file); + else if (entry->d_type == DT_REG) + sf = symlink_sf = fs::file_status(fs::regular_file); + else if (entry->d_type == DT_LNK) + { + sf = fs::file_status(fs::status_error); + symlink_sf = fs::file_status(fs::symlink_file); + } + else sf = symlink_sf = fs::file_status(fs::status_error); + } +# else + sf = symlink_sf = fs::file_status(fs::status_error); +# endif + return ok; + } + +# else // BOOST_WINDOWS_API + + error_code dir_itr_first(void *& handle, const fs::path& dir, + wstring& target, fs::file_status & sf, fs::file_status & symlink_sf) + // Note: an empty root directory has no "." or ".." entries, so this + // causes a ERROR_FILE_NOT_FOUND error which we do not considered an + // error. It is treated as eof instead. + { + // use a form of search Sebastian Martel reports will work with Win98 + wstring dirpath(dir.wstring()); + dirpath += (dirpath.empty() + || (dirpath[dirpath.size()-1] != L'\\' + && dirpath[dirpath.size()-1] != L'/' + && dirpath[dirpath.size()-1] != L':'))? L"\\*" : L"*"; + + WIN32_FIND_DATAW data; + if ((handle = ::FindFirstFileW(dirpath.c_str(), &data)) + == INVALID_HANDLE_VALUE) + { + handle = 0; // signal eof + return error_code( (::GetLastError() == ERROR_FILE_NOT_FOUND + // Windows Mobile returns ERROR_NO_MORE_FILES; see ticket #3551 + || ::GetLastError() == ERROR_NO_MORE_FILES) + ? 0 : ::GetLastError(), system_category() ); + } + target = data.cFileName; + if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) + // reparse points are complex, so don't try to handle them here; instead just mark + // them as status_error which causes directory_entry caching to call status() + // and symlink_status() which do handle reparse points fully + { + sf.type(fs::status_error); + symlink_sf.type(fs::status_error); + } + else + { + if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + sf.type(fs::directory_file); + symlink_sf.type(fs::directory_file); + } + else + { + sf.type(fs::regular_file); + symlink_sf.type(fs::regular_file); + } + sf.permissions(make_permissions(data.cFileName, data.dwFileAttributes)); + symlink_sf.permissions(sf.permissions()); + } + return error_code(); + } + + error_code dir_itr_increment(void *& handle, wstring& target, + fs::file_status & sf, fs::file_status & symlink_sf) + { + WIN32_FIND_DATAW data; + if (::FindNextFileW(handle, &data)== 0)// fails + { + int error = ::GetLastError(); + fs::detail::dir_itr_close(handle); + return error_code(error == ERROR_NO_MORE_FILES ? 0 : error, system_category()); + } + target = data.cFileName; + if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) + // reparse points are complex, so don't try to handle them here; instead just mark + // them as status_error which causes directory_entry caching to call status() + // and symlink_status() which do handle reparse points fully + { + sf.type(fs::status_error); + symlink_sf.type(fs::status_error); + } + else + { + if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + sf.type(fs::directory_file); + symlink_sf.type(fs::directory_file); + } + else + { + sf.type(fs::regular_file); + symlink_sf.type(fs::regular_file); + } + sf.permissions(make_permissions(data.cFileName, data.dwFileAttributes)); + symlink_sf.permissions(sf.permissions()); + } + return error_code(); + } +#endif + + const error_code not_found_error_code ( +# ifdef BOOST_WINDOWS_API + ERROR_PATH_NOT_FOUND +# else + ENOENT +# endif + , system_category()); + +} // unnamed namespace + +namespace boost +{ +namespace filesystem3 +{ + +namespace detail +{ + // dir_itr_close is called both from the ~dir_itr_imp()destructor + // and dir_itr_increment() + BOOST_FILESYSTEM_DECL + system::error_code dir_itr_close( // never throws + void *& handle +# if defined(BOOST_POSIX_API) + , void *& buffer +# endif + ) + { +# ifdef BOOST_POSIX_API + std::free(buffer); + buffer = 0; + if (handle == 0)return ok; + DIR * h(static_cast<DIR*>(handle)); + handle = 0; + return error_code(::closedir(h)== 0 ? 0 : errno, system_category()); + +# else + if (handle != 0) + { + ::FindClose(handle); + handle = 0; + } + return ok; + +# endif + } + + void directory_iterator_construct(directory_iterator& it, + const path& p, system::error_code* ec) + { + if (error(p.empty(), not_found_error_code, p, ec, + "boost::filesystem::directory_iterator::construct")) + return; + + path::string_type filename; + file_status file_stat, symlink_file_stat; + error_code result = dir_itr_first(it.m_imp->handle, +# if defined(BOOST_POSIX_API) + it.m_imp->buffer, +# endif + p.c_str(), filename, file_stat, symlink_file_stat); + + if (result) + { + it.m_imp.reset(); + error(true, result, p, + ec, "boost::filesystem::directory_iterator::construct"); + return; + } + + if (it.m_imp->handle == 0) + it.m_imp.reset(); // eof, so make end iterator + else // not eof + { + it.m_imp->dir_entry.assign(p / filename, file_stat, symlink_file_stat); + if (filename[0] == dot // dot or dot-dot + && (filename.size()== 1 + || (filename[1] == dot + && filename.size()== 2))) + { it.increment(*ec); } + } + } + + void directory_iterator_increment(directory_iterator& it, + system::error_code* ec) + { + BOOST_ASSERT_MSG(it.m_imp.get(), "attempt to increment end iterator"); + BOOST_ASSERT_MSG(it.m_imp->handle != 0, "internal program error"); + + path::string_type filename; + file_status file_stat, symlink_file_stat; + system::error_code temp_ec; + + for (;;) + { + temp_ec = dir_itr_increment(it.m_imp->handle, +# if defined(BOOST_POSIX_API) + it.m_imp->buffer, +# endif + filename, file_stat, symlink_file_stat); + + if (temp_ec) // happens if filesystem is corrupt, such as on a damaged optical disc + { + path error_path(it.m_imp->dir_entry.path().parent_path()); // fix ticket #5900 + it.m_imp.reset(); + if (ec == 0) + BOOST_FILESYSTEM_THROW( + filesystem_error("boost::filesystem::directory_iterator::operator++", + error_path, + error_code(BOOST_ERRNO, system_category()))); + ec->assign(BOOST_ERRNO, system_category()); + return; + } + else if (ec != 0) ec->clear(); + + if (it.m_imp->handle == 0) // eof, make end + { + it.m_imp.reset(); + return; + } + + if (!(filename[0] == dot // !(dot or dot-dot) + && (filename.size()== 1 + || (filename[1] == dot + && filename.size()== 2)))) + { + it.m_imp->dir_entry.replace_filename( + filename, file_stat, symlink_file_stat); + return; + } + } + } +} // namespace detail +} // namespace filesystem3 +} // namespace boost + +#endif // no wide character support diff --git a/libs/filesystem/v3/src/path.cpp b/libs/filesystem/v3/src/path.cpp new file mode 100644 index 0000000000..c64cad2b3b --- /dev/null +++ b/libs/filesystem/v3/src/path.cpp @@ -0,0 +1,847 @@ +// filesystem path.cpp ------------------------------------------------------------- // + +// Copyright Beman Dawes 2008 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#include <boost/config.hpp> +#if !defined( BOOST_NO_STD_WSTRING ) +// Boost.Filesystem V3 and later requires std::wstring support. +// During the transition to V3, libraries are compiled with both V2 and V3 sources. +// On old compilers that don't support V3 anyhow, we just skip everything so the compile +// will succeed and the library can be built. + +// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/v3/config.hpp> +#include <boost/filesystem/v3/path.hpp> +#include <boost/scoped_array.hpp> +#include <boost/system/error_code.hpp> +#include <boost/assert.hpp> +#include <algorithm> +#include <cstddef> +#include <cstring> +#include <cassert> + +#ifdef BOOST_WINDOWS_API +# include "windows_file_codecvt.hpp" +# include <windows.h> +#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) +# include <boost/filesystem/detail/utf8_codecvt_facet.hpp> +#endif + +#ifdef BOOST_FILESYSTEM_DEBUG +# include <iostream> +# include <iomanip> +#endif + +namespace fs = boost::filesystem3; + +using boost::filesystem3::path; + +using std::string; +using std::wstring; + +using boost::system::error_code; + +#ifndef BOOST_FILESYSTEM_CODECVT_BUF_SIZE +# define BOOST_FILESYSTEM_CODECVT_BUF_SIZE 256 +#endif + +//--------------------------------------------------------------------------------------// +// // +// class path helpers // +// // +//--------------------------------------------------------------------------------------// + +namespace +{ + //------------------------------------------------------------------------------------// + // miscellaneous class path helpers // + //------------------------------------------------------------------------------------// + + typedef path::value_type value_type; + typedef path::string_type string_type; + typedef string_type::size_type size_type; + + const std::size_t default_codecvt_buf_size = BOOST_FILESYSTEM_CODECVT_BUF_SIZE; + +# ifdef BOOST_WINDOWS_API + + const wchar_t separator = L'/'; + const wchar_t preferred_separator = L'\\'; + const wchar_t* const separators = L"/\\"; + const wchar_t* separator_string = L"/"; + const wchar_t* preferred_separator_string = L"\\"; + const wchar_t colon = L':'; + const wchar_t dot = L'.'; + const wchar_t questionmark = L'?'; + const fs::path dot_path(L"."); + const fs::path dot_dot_path(L".."); + +# else + + const char separator = '/'; + const char preferred_separator = '/'; + const char* const separators = "/"; + const char* separator_string = "/"; + const char* preferred_separator_string = "/"; + const char colon = ':'; + const char dot = '.'; + const fs::path dot_path("."); + const fs::path dot_dot_path(".."); + +# endif + + inline bool is_separator(fs::path::value_type c) + { + return c == separator +# ifdef BOOST_WINDOWS_API + || c == preferred_separator +# endif + ; + } + + bool is_non_root_separator(const string_type& str, size_type pos); + // pos is position of the separator + + size_type filename_pos(const string_type& str, + size_type end_pos); // end_pos is past-the-end position + // Returns: 0 if str itself is filename (or empty) + + size_type root_directory_start(const string_type& path, size_type size); + // Returns: npos if no root_directory found + + void first_element( + const string_type& src, + size_type& element_pos, + size_type& element_size, +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1310) // VC++ 7.1 + size_type size = string_type::npos +# else + size_type size = -1 +# endif + ); + +} // unnamed namespace + +//--------------------------------------------------------------------------------------// +// // +// class path implementation // +// // +//--------------------------------------------------------------------------------------// + +namespace boost +{ +namespace filesystem3 +{ + + path& path::operator/=(const path& p) + { + if (p.empty()) + return *this; + if (this == &p) // self-append + { + path rhs(p); + if (!is_separator(rhs.m_pathname[0])) + m_append_separator_if_needed(); + m_pathname += rhs.m_pathname; + } + else + { + if (!is_separator(*p.m_pathname.begin())) + m_append_separator_if_needed(); + m_pathname += p.m_pathname; + } + return *this; + } + + path& path::operator/=(const value_type* ptr) + { + if (!*ptr) + return *this; + if (ptr >= m_pathname.data() + && ptr < m_pathname.data() + m_pathname.size()) // overlapping source + { + path rhs(ptr); + if (!is_separator(rhs.m_pathname[0])) + m_append_separator_if_needed(); + m_pathname += rhs.m_pathname; + } + else + { + if (!is_separator(*ptr)) + m_append_separator_if_needed(); + m_pathname += ptr; + } + return *this; + } + +# ifdef BOOST_WINDOWS_API + + const std::string path::generic_string(const codecvt_type& cvt) const + { + path tmp(*this); + std::replace(tmp.m_pathname.begin(), tmp.m_pathname.end(), L'\\', L'/'); + return tmp.string(cvt); + } + + const std::wstring path::generic_wstring() const + { + path tmp(*this); + std::replace(tmp.m_pathname.begin(), tmp.m_pathname.end(), L'\\', L'/'); + return tmp.wstring(); + } + +# endif // BOOST_WINDOWS_API + + // m_append_separator_if_needed ----------------------------------------------------// + + path::string_type::size_type path::m_append_separator_if_needed() + { + if (!m_pathname.empty() && +# ifdef BOOST_WINDOWS_API + *(m_pathname.end()-1) != colon && +# endif + !is_separator(*(m_pathname.end()-1))) + { + string_type::size_type tmp(m_pathname.size()); + m_pathname += preferred_separator; + return tmp; + } + return 0; + } + + // m_erase_redundant_separator -----------------------------------------------------// + + void path::m_erase_redundant_separator(string_type::size_type sep_pos) + { + if (sep_pos // a separator was added + && sep_pos < m_pathname.size() // and something was appended + && (m_pathname[sep_pos+1] == separator // and it was also separator +# ifdef BOOST_WINDOWS_API + || m_pathname[sep_pos+1] == preferred_separator // or preferred_separator +# endif +)) { m_pathname.erase(sep_pos, 1); } // erase the added separator + } + + // modifiers -----------------------------------------------------------------------// + +# ifdef BOOST_WINDOWS_API + path & path::make_preferred() + { + std::replace(m_pathname.begin(), m_pathname.end(), L'/', L'\\'); + return *this; + } +# endif + + path& path::remove_filename() + { + m_pathname.erase(m_parent_path_end()); + return *this; + } + + path & path::replace_extension(const path & source) + { + // erase existing extension if any + size_type pos(m_pathname.rfind(dot)); + if (pos != string_type::npos && pos >= filename_pos(m_pathname, m_pathname.size())) + m_pathname.erase(pos); + + // append source extension if any + pos = source.m_pathname.rfind(dot); + if (pos != string_type::npos) + m_pathname += source.c_str() + pos; + + return *this; + } + + // decomposition -------------------------------------------------------------------// + + path path::root_path() const + { + path temp(root_name()); + if (!root_directory().empty()) temp.m_pathname += root_directory().c_str(); + return temp; + } + + path path::root_name() const + { + iterator itr(begin()); + + return (itr.m_pos != m_pathname.size() + && ( + (itr.m_element.m_pathname.size() > 1 + && is_separator(itr.m_element.m_pathname[0]) + && is_separator(itr.m_element.m_pathname[1]) + ) +# ifdef BOOST_WINDOWS_API + || itr.m_element.m_pathname[itr.m_element.m_pathname.size()-1] == colon +# endif + )) + ? itr.m_element + : path(); + } + + path path::root_directory() const + { + size_type pos(root_directory_start(m_pathname, m_pathname.size())); + + return pos == string_type::npos + ? path() + : path(m_pathname.c_str() + pos, m_pathname.c_str() + pos + 1); + } + + path path::relative_path() const + { + iterator itr(begin()); + + for (; itr.m_pos != m_pathname.size() + && (is_separator(itr.m_element.m_pathname[0]) +# ifdef BOOST_WINDOWS_API + || itr.m_element.m_pathname[itr.m_element.m_pathname.size()-1] == colon +# endif + ); ++itr) {} + + return path(m_pathname.c_str() + itr.m_pos); + } + + string_type::size_type path::m_parent_path_end() const + { + size_type end_pos(filename_pos(m_pathname, m_pathname.size())); + + bool filename_was_separator(m_pathname.size() + && is_separator(m_pathname[end_pos])); + + // skip separators unless root directory + size_type root_dir_pos(root_directory_start(m_pathname, end_pos)); + for (; + end_pos > 0 + && (end_pos-1) != root_dir_pos + && is_separator(m_pathname[end_pos-1]) + ; + --end_pos) {} + + return (end_pos == 1 && root_dir_pos == 0 && filename_was_separator) + ? string_type::npos + : end_pos; + } + + path path::parent_path() const + { + size_type end_pos(m_parent_path_end()); + return end_pos == string_type::npos + ? path() + : path(m_pathname.c_str(), m_pathname.c_str() + end_pos); + } + + path path::filename() const + { + size_type pos(filename_pos(m_pathname, m_pathname.size())); + return (m_pathname.size() + && pos + && is_separator(m_pathname[pos]) + && is_non_root_separator(m_pathname, pos)) + ? dot_path + : path(m_pathname.c_str() + pos); + } + + path path::stem() const + { + path name(filename()); + if (name == dot_path || name == dot_dot_path) return name; + size_type pos(name.m_pathname.rfind(dot)); + return pos == string_type::npos + ? name + : path(name.m_pathname.c_str(), name.m_pathname.c_str() + pos); + } + + path path::extension() const + { + path name(filename()); + if (name == dot_path || name == dot_dot_path) return path(); + size_type pos(name.m_pathname.rfind(dot)); + return pos == string_type::npos + ? path() + : path(name.m_pathname.c_str() + pos); + } + + // m_normalize ----------------------------------------------------------------------// + + path& path::m_normalize() + { + if (m_pathname.empty()) return *this; + + path temp; + iterator start(begin()); + iterator last(end()); + iterator stop(last--); + for (iterator itr(start); itr != stop; ++itr) + { + // ignore "." except at start and last + if (itr->native().size() == 1 + && (itr->native())[0] == dot + && itr != start + && itr != last) continue; + + // ignore a name and following ".." + if (!temp.empty() + && itr->native().size() == 2 + && (itr->native())[0] == dot + && (itr->native())[1] == dot) // dot dot + { + string_type lf(temp.filename().native()); + if (lf.size() > 0 + && (lf.size() != 1 + || (lf[0] != dot + && lf[0] != separator)) + && (lf.size() != 2 + || (lf[0] != dot + && lf[1] != dot +# ifdef BOOST_WINDOWS_API + && lf[1] != colon +# endif + ) + ) + ) + { + temp.remove_filename(); + // if not root directory, must also remove "/" if any + if (temp.m_pathname.size() > 0 + && temp.m_pathname[temp.m_pathname.size()-1] + == separator) + { + string_type::size_type rds( + root_directory_start(temp.m_pathname, temp.m_pathname.size())); + if (rds == string_type::npos + || rds != temp.m_pathname.size()-1) + { temp.m_pathname.erase(temp.m_pathname.size()-1); } + } + + iterator next(itr); + if (temp.empty() && ++next != stop + && next == last && *last == dot_path) temp /= dot_path; + continue; + } + } + + temp /= *itr; + }; + + if (temp.empty()) temp /= dot_path; + m_pathname = temp.m_pathname; + return *this; + } + +} // namespace filesystem3 +} // namespace boost + +//--------------------------------------------------------------------------------------// +// // +// class path helpers implementation // +// // +//--------------------------------------------------------------------------------------// + +namespace +{ + + // is_non_root_separator -------------------------------------------------// + + bool is_non_root_separator(const string_type & str, size_type pos) + // pos is position of the separator + { + BOOST_ASSERT_MSG(!str.empty() && is_separator(str[pos]), + "precondition violation"); + + // subsequent logic expects pos to be for leftmost slash of a set + while (pos > 0 && is_separator(str[pos-1])) + --pos; + + return pos != 0 + && (pos <= 2 || !is_separator(str[1]) + || str.find_first_of(separators, 2) != pos) +# ifdef BOOST_WINDOWS_API + && (pos !=2 || str[1] != colon) +# endif + ; + } + + // filename_pos --------------------------------------------------------------------// + + size_type filename_pos(const string_type & str, + size_type end_pos) // end_pos is past-the-end position + // return 0 if str itself is filename (or empty) + { + // case: "//" + if (end_pos == 2 + && is_separator(str[0]) + && is_separator(str[1])) return 0; + + // case: ends in "/" + if (end_pos && is_separator(str[end_pos-1])) + return end_pos-1; + + // set pos to start of last element + size_type pos(str.find_last_of(separators, end_pos-1)); + +# ifdef BOOST_WINDOWS_API + if (pos == string_type::npos) + pos = str.find_last_of(colon, end_pos-2); +# endif + + return (pos == string_type::npos // path itself must be a filename (or empty) + || (pos == 1 && is_separator(str[0]))) // or net + ? 0 // so filename is entire string + : pos + 1; // or starts after delimiter + } + + // root_directory_start ------------------------------------------------------------// + + size_type root_directory_start(const string_type & path, size_type size) + // return npos if no root_directory found + { + +# ifdef BOOST_WINDOWS_API + // case "c:/" + if (size > 2 + && path[1] == colon + && is_separator(path[2])) return 2; +# endif + + // case "//" + if (size == 2 + && is_separator(path[0]) + && is_separator(path[1])) return string_type::npos; + +# ifdef BOOST_WINDOWS_API + // case "\\?\" + if (size > 4 + && is_separator(path[0]) + && is_separator(path[1]) + && path[2] == questionmark + && is_separator(path[3])) + { + string_type::size_type pos(path.find_first_of(separators, 4)); + return pos < size ? pos : string_type::npos; + } +# endif + + // case "//net {/}" + if (size > 3 + && is_separator(path[0]) + && is_separator(path[1]) + && !is_separator(path[2])) + { + string_type::size_type pos(path.find_first_of(separators, 2)); + return pos < size ? pos : string_type::npos; + } + + // case "/" + if (size > 0 && is_separator(path[0])) return 0; + + return string_type::npos; + } + + // first_element --------------------------------------------------------------------// + // sets pos and len of first element, excluding extra separators + // if src.empty(), sets pos,len, to 0,0. + + void first_element( + const string_type & src, + size_type & element_pos, + size_type & element_size, + size_type size +) + { + if (size == string_type::npos) size = src.size(); + element_pos = 0; + element_size = 0; + if (src.empty()) return; + + string_type::size_type cur(0); + + // deal with // [network] + if (size >= 2 && is_separator(src[0]) + && is_separator(src[1]) + && (size == 2 + || !is_separator(src[2]))) + { + cur += 2; + element_size += 2; + } + + // leading (not non-network) separator + else if (is_separator(src[0])) + { + ++element_size; + // bypass extra leading separators + while (cur+1 < size + && is_separator(src[cur+1])) + { + ++cur; + ++element_pos; + } + return; + } + + // at this point, we have either a plain name, a network name, + // or (on Windows only) a device name + + // find the end + while (cur < size +# ifdef BOOST_WINDOWS_API + && src[cur] != colon +# endif + && !is_separator(src[cur])) + { + ++cur; + ++element_size; + } + +# ifdef BOOST_WINDOWS_API + if (cur == size) return; + // include device delimiter + if (src[cur] == colon) + { ++element_size; } +# endif + + return; + } + +} // unnammed namespace + +//--------------------------------------------------------------------------------------// +// // +// class path::iterator implementation // +// // +//--------------------------------------------------------------------------------------// + +namespace boost +{ +namespace filesystem3 +{ + + path::iterator path::begin() const + { + iterator itr; + itr.m_path_ptr = this; + size_type element_size; + first_element(m_pathname, itr.m_pos, element_size); + itr.m_element = m_pathname.substr(itr.m_pos, element_size); + if (itr.m_element.m_pathname == preferred_separator_string) + itr.m_element.m_pathname = separator_string; // needed for Windows, harmless on POSIX + return itr; + } + + path::iterator path::end() const + { + iterator itr; + itr.m_path_ptr = this; + itr.m_pos = m_pathname.size(); + return itr; + } + + void path::m_path_iterator_increment(path::iterator & it) + { + BOOST_ASSERT_MSG(it.m_pos < it.m_path_ptr->m_pathname.size(), + "path::basic_iterator increment past end()"); + + // increment to position past current element + it.m_pos += it.m_element.m_pathname.size(); + + // if end reached, create end basic_iterator + if (it.m_pos == it.m_path_ptr->m_pathname.size()) + { + it.m_element.clear(); + return; + } + + // both POSIX and Windows treat paths that begin with exactly two separators specially + bool was_net(it.m_element.m_pathname.size() > 2 + && is_separator(it.m_element.m_pathname[0]) + && is_separator(it.m_element.m_pathname[1]) + && !is_separator(it.m_element.m_pathname[2])); + + // process separator (Windows drive spec is only case not a separator) + if (is_separator(it.m_path_ptr->m_pathname[it.m_pos])) + { + // detect root directory + if (was_net +# ifdef BOOST_WINDOWS_API + // case "c:/" + || it.m_element.m_pathname[it.m_element.m_pathname.size()-1] == colon +# endif + ) + { + it.m_element.m_pathname = separator; + return; + } + + // bypass separators + while (it.m_pos != it.m_path_ptr->m_pathname.size() + && is_separator(it.m_path_ptr->m_pathname[it.m_pos])) + { ++it.m_pos; } + + // detect trailing separator, and treat it as ".", per POSIX spec + if (it.m_pos == it.m_path_ptr->m_pathname.size() + && is_non_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1)) + { + --it.m_pos; + it.m_element = dot_path; + return; + } + } + + // get next element + size_type end_pos(it.m_path_ptr->m_pathname.find_first_of(separators, it.m_pos)); + if (end_pos == string_type::npos) end_pos = it.m_path_ptr->m_pathname.size(); + it.m_element = it.m_path_ptr->m_pathname.substr(it.m_pos, end_pos - it.m_pos); + } + + void path::m_path_iterator_decrement(path::iterator & it) + { + BOOST_ASSERT_MSG(it.m_pos, "path::iterator decrement past begin()"); + + size_type end_pos(it.m_pos); + + // if at end and there was a trailing non-root '/', return "." + if (it.m_pos == it.m_path_ptr->m_pathname.size() + && it.m_path_ptr->m_pathname.size() > 1 + && is_separator(it.m_path_ptr->m_pathname[it.m_pos-1]) + && is_non_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1) + ) + { + --it.m_pos; + it.m_element = dot_path; + return; + } + + size_type root_dir_pos(root_directory_start(it.m_path_ptr->m_pathname, end_pos)); + + // skip separators unless root directory + for ( + ; + end_pos > 0 + && (end_pos-1) != root_dir_pos + && is_separator(it.m_path_ptr->m_pathname[end_pos-1]) + ; + --end_pos) {} + + it.m_pos = filename_pos(it.m_path_ptr->m_pathname, end_pos); + it.m_element = it.m_path_ptr->m_pathname.substr(it.m_pos, end_pos - it.m_pos); + if (it.m_element.m_pathname == preferred_separator_string) + it.m_element.m_pathname = separator_string; // needed for Windows, harmless on POSIX + } + +} // namespace filesystem3 +} // namespace boost + +//--------------------------------------------------------------------------------------// +// // +// detail helpers // +// // +//--------------------------------------------------------------------------------------// + +namespace +{ + + //------------------------------------------------------------------------------------// + // locale helpers // + //------------------------------------------------------------------------------------// + +#ifdef BOOST_WINDOWS_API + + std::locale path_locale(std::locale(), new windows_file_codecvt); + + const std::codecvt<wchar_t, char, std::mbstate_t>* + codecvt_facet(&std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > + (path_locale)); + +#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) + + // "All BSD system functions expect their string parameters to be in UTF-8 encoding + // and nothing else." See + // http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html + // + // "The kernel will reject any filename that is not a valid UTF-8 string, and it will + // even be normalized (to Unicode NFD) before stored on disk, at least when using HFS. + // The right way to deal with it would be to always convert the filename to UTF-8 + // before trying to open/create a file." See + // http://lists.apple.com/archives/unix-porting/2007/Sep/msg00023.html + // + // "How a file name looks at the API level depends on the API. Current Carbon APIs + // handle file names as an array of UTF-16 characters; POSIX ones handle them as an + // array of UTF-8, which is why UTF-8 works well in Terminal. How it's stored on disk + // depends on the disk format; HFS+ uses UTF-16, but that's not important in most + // cases." See + // http://lists.apple.com/archives/applescript-users/2002/Sep/msg00319.html + // + // Many thanks to Peter Dimov for digging out the above references! + + std::locale path_locale(std::locale(), + new boost::filesystem::detail::utf8_codecvt_facet); + + const std::codecvt<wchar_t, char, std::mbstate_t>* + codecvt_facet(&std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > + (path_locale)); + +#else // Other POSIX + + // ISO C calls std::locale("") "the locale-specific native environment", and this + // locale is the default for many POSIX-based operating systems such as Linux. + + // std::locale("") construction can throw (if environmental variables LC_MESSAGES or + // or LANG are wrong, for example), so lazy initialization is used to ensure + // that exceptions occur after main() starts and so can be caught. + + std::locale path_locale; // initialized by path::wchar_t_codecvt_facet() below + const std::codecvt<wchar_t, char, std::mbstate_t>* codecvt_facet; // ditto + +# endif + +} // unnamed namespace + +//--------------------------------------------------------------------------------------// +// path::imbue implementation // +//--------------------------------------------------------------------------------------// + +namespace boost +{ +namespace filesystem3 +{ + + const path::codecvt_type*& path::wchar_t_codecvt_facet() + { +# if defined(BOOST_POSIX_API) && \ + !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) + // A local static initialized by calling path::imbue ensures that std::locale(""), + // which may throw, is called only if path_locale and condecvt_facet will actually + // be used. Thus misconfigured environmental variables will only cause an + // exception if a valid std::locale("") is actually needed. + static std::locale posix_lazy_initialization(path::imbue(std::locale(""))); +# endif + return codecvt_facet; + } + + std::locale path::imbue(const std::locale& loc) + { + std::locale temp(path_locale); + path_locale = loc; + codecvt_facet = + &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale); + return temp; + } + +} // namespace filesystem3 +} // namespace boost + +#endif // has wide character support diff --git a/libs/filesystem/v3/src/path_traits.cpp b/libs/filesystem/v3/src/path_traits.cpp new file mode 100644 index 0000000000..66064370bc --- /dev/null +++ b/libs/filesystem/v3/src/path_traits.cpp @@ -0,0 +1,209 @@ +// filesystem path_traits.cpp --------------------------------------------------------// + +// Copyright Beman Dawes 2008, 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +#include <boost/config.hpp> +#if !defined( BOOST_NO_STD_WSTRING ) +// Boost.Filesystem V3 and later requires std::wstring support. +// During the transition to V3, libraries are compiled with both V2 and V3 sources. +// On old compilers that don't support V3 anyhow, we just skip everything so the compile +// will succeed and the library can be built. + +// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/v3/config.hpp> +#include <boost/filesystem/v3/path_traits.hpp> +#include <boost/system/system_error.hpp> +#include <boost/scoped_array.hpp> +#include <locale> // for codecvt_base::result +#include <cstring> // for strlen +#include <cwchar> // for wcslen + +namespace pt = boost::filesystem3::path_traits; +namespace fs = boost::filesystem3; +namespace bs = boost::system; + +//--------------------------------------------------------------------------------------// +// configuration // +//--------------------------------------------------------------------------------------// + +#ifndef BOOST_FILESYSTEM_CODECVT_BUF_SIZE +# define BOOST_FILESYSTEM_CODECVT_BUF_SIZE 256 +#endif + +namespace { + + const std::size_t default_codecvt_buf_size = BOOST_FILESYSTEM_CODECVT_BUF_SIZE; + + +//--------------------------------------------------------------------------------------// +// // +// The public convert() functions do buffer management, and then forward to the // +// convert_aux() functions for the actual call to the codecvt facet. // +// // +//--------------------------------------------------------------------------------------// + +//--------------------------------------------------------------------------------------// +// convert_aux const char* to wstring // +//--------------------------------------------------------------------------------------// + + void convert_aux( + const char* from, + const char* from_end, + wchar_t* to, wchar_t* to_end, + std::wstring & target, + const pt::codecvt_type & cvt) + { + //std::cout << std::hex + // << " from=" << std::size_t(from) + // << " from_end=" << std::size_t(from_end) + // << " to=" << std::size_t(to) + // << " to_end=" << std::size_t(to_end) + // << std::endl; + + std::mbstate_t state = std::mbstate_t(); // perhaps unneeded, but cuts bug reports + const char* from_next; + wchar_t* to_next; + + std::codecvt_base::result res; + + if ((res=cvt.in(state, from, from_end, from_next, + to, to_end, to_next)) != std::codecvt_base::ok) + { + //std::cout << " result is " << static_cast<int>(res) << std::endl; + BOOST_FILESYSTEM_THROW(bs::system_error(res, fs::codecvt_error_category(), + "boost::filesystem::path codecvt to wstring")); + } + target.append(to, to_next); + } + +//--------------------------------------------------------------------------------------// +// convert_aux const wchar_t* to string // +//--------------------------------------------------------------------------------------// + + void convert_aux( + const wchar_t* from, + const wchar_t* from_end, + char* to, char* to_end, + std::string & target, + const pt::codecvt_type & cvt) + { + //std::cout << std::hex + // << " from=" << std::size_t(from) + // << " from_end=" << std::size_t(from_end) + // << " to=" << std::size_t(to) + // << " to_end=" << std::size_t(to_end) + // << std::endl; + + std::mbstate_t state = std::mbstate_t(); // perhaps unneeded, but cuts bug reports + const wchar_t* from_next; + char* to_next; + + std::codecvt_base::result res; + + if ((res=cvt.out(state, from, from_end, from_next, + to, to_end, to_next)) != std::codecvt_base::ok) + { + //std::cout << " result is " << static_cast<int>(res) << std::endl; + BOOST_FILESYSTEM_THROW(bs::system_error(res, fs::codecvt_error_category(), + "boost::filesystem::path codecvt to string")); + } + target.append(to, to_next); + } + +} // unnamed namespace + +//--------------------------------------------------------------------------------------// +// path_traits // +//--------------------------------------------------------------------------------------// + +namespace boost { namespace filesystem3 { namespace path_traits { + +//--------------------------------------------------------------------------------------// +// convert const char* to wstring // +//--------------------------------------------------------------------------------------// + + BOOST_FILESYSTEM_DECL + void convert(const char* from, + const char* from_end, // 0 for null terminated MBCS + std::wstring & to, + const codecvt_type & cvt) + { + BOOST_ASSERT(from); + + if (!from_end) // null terminated + { + from_end = from + std::strlen(from); + } + + if (from == from_end) return; + + std::size_t buf_size = (from_end - from) * 3; // perhaps too large, but that's OK + + // dynamically allocate a buffer only if source is unusually large + if (buf_size > default_codecvt_buf_size) + { + boost::scoped_array< wchar_t > buf(new wchar_t [buf_size]); + convert_aux(from, from_end, buf.get(), buf.get()+buf_size, to, cvt); + } + else + { + wchar_t buf[default_codecvt_buf_size]; + convert_aux(from, from_end, buf, buf+default_codecvt_buf_size, to, cvt); + } + } + +//--------------------------------------------------------------------------------------// +// convert const wchar_t* to string // +//--------------------------------------------------------------------------------------// + + BOOST_FILESYSTEM_DECL + void convert(const wchar_t* from, + const wchar_t* from_end, // 0 for null terminated MBCS + std::string & to, + const codecvt_type & cvt) + { + BOOST_ASSERT(from); + + if (!from_end) // null terminated + { + from_end = from + std::wcslen(from); + } + + if (from == from_end) return; + + // The codecvt length functions may not be implemented, and I don't really + // understand them either. Thus this code is just a guess; if it turns + // out the buffer is too small then an error will be reported and the code + // will have to be fixed. + std::size_t buf_size = (from_end - from) * 4; // perhaps too large, but that's OK + buf_size += 4; // encodings like shift-JIS need some prefix space + + // dynamically allocate a buffer only if source is unusually large + if (buf_size > default_codecvt_buf_size) + { + boost::scoped_array< char > buf(new char [buf_size]); + convert_aux(from, from_end, buf.get(), buf.get()+buf_size, to, cvt); + } + else + { + char buf[default_codecvt_buf_size]; + convert_aux(from, from_end, buf, buf+default_codecvt_buf_size, to, cvt); + } + } +}}} // namespace boost::filesystem3::path_traits + +#endif // no wide character support diff --git a/libs/filesystem/v3/src/portability.cpp b/libs/filesystem/v3/src/portability.cpp new file mode 100644 index 0000000000..31e0176271 --- /dev/null +++ b/libs/filesystem/v3/src/portability.cpp @@ -0,0 +1,128 @@ +// portability.cpp -------------------------------------------------------------------// + +// Copyright 2002-2005 Beman Dawes +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy +// at http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +#include <boost/config.hpp> +#if !defined( BOOST_NO_STD_WSTRING ) +// Boost.Filesystem V3 and later requires std::wstring support. +// During the transition to V3, libraries are compiled with both V2 and V3 sources. +// On old compilers that don't support V3 anyhow, we just skip everything so the compile +// will succeed and the library can be built. + +// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/v3/config.hpp> +#include <boost/filesystem/v3/path.hpp> + +namespace fs = boost::filesystem3; + +#include <cstring> // SGI MIPSpro compilers need this + +# ifdef BOOST_NO_STDC_NAMESPACE + namespace std { using ::strerror; } +# endif + +//--------------------------------------------------------------------------------------// + +namespace +{ + const char invalid_chars[] = + "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" + "<>:\"/\\|"; + // note that the terminating '\0' is part of the string - thus the size below + // is sizeof(invalid_chars) rather than sizeof(invalid_chars)-1. I + const std::string windows_invalid_chars(invalid_chars, sizeof(invalid_chars)); + + const std::string valid_posix( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-"); + +} // unnamed namespace + +namespace boost +{ + namespace filesystem3 + { + + // name_check functions ----------------------------------------------// + +# ifdef BOOST_WINDOWS + BOOST_FILESYSTEM_DECL bool native(const std::string & name) + { + return windows_name(name); + } +# else + BOOST_FILESYSTEM_DECL bool native(const std::string & name) + { + return name.size() != 0 + && name[0] != ' ' + && name.find('/') == std::string::npos; + } +# endif + + BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name) + { + return name.size() != 0 + && name.find_first_not_of(valid_posix) == std::string::npos; + } + + BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name) + { + return name.size() != 0 + && name[0] != ' ' + && name.find_first_of(windows_invalid_chars) == std::string::npos + && *(name.end()-1) != ' ' + && (*(name.end()-1) != '.' + || name.length() == 1 || name == ".."); + } + + BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name) + { + return + name.size() != 0 + && (name == "." + || name == ".." + || (windows_name(name) + && portable_posix_name(name) + && name[0] != '.' && name[0] != '-')); + } + + BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name) + { + return + name == "." + || name == ".." + || (portable_name(name) + && name.find('.') == std::string::npos); + } + + BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name) + { + std::string::size_type pos; + return + portable_name(name) + && name != "." + && name != ".." + && ((pos = name.find('.')) == std::string::npos + || (name.find('.', pos+1) == std::string::npos + && (pos + 5) > name.length())) + ; + } + + } // namespace filesystem3 +} // namespace boost + +#endif // no wide character support diff --git a/libs/filesystem/v3/src/unique_path.cpp b/libs/filesystem/v3/src/unique_path.cpp new file mode 100644 index 0000000000..1569b32e91 --- /dev/null +++ b/libs/filesystem/v3/src/unique_path.cpp @@ -0,0 +1,151 @@ +// filesystem system_crypt_random.cpp ------------------------------------------------// + +// Copyright Beman Dawes 2010 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +#include <boost/config.hpp> +#if !defined( BOOST_NO_STD_WSTRING ) +// Boost.Filesystem V3 and later requires std::wstring support. +// During the transition to V3, libraries are compiled with both V2 and V3 sources. +// On old compilers that don't support V3 anyhow, we just skip everything so the compile +// will succeed and the library can be built. + +// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/v3/operations.hpp> + +# ifdef BOOST_POSIX_API +# include <fcntl.h> +# else // BOOST_WINDOWS_API +# include <windows.h> +# include <wincrypt.h> +# pragma comment(lib, "Advapi32.lib") +# endif + +namespace { + +void fail(int err, boost::system::error_code* ec) +{ + if (ec == 0) + BOOST_FILESYSTEM_THROW( boost::system::system_error(err, + boost::system::system_category(), + "boost::filesystem::unique_path")); + + ec->assign(err, boost::system::system_category()); + return; +} + +void system_crypt_random(void* buf, std::size_t len, boost::system::error_code* ec) +{ +# ifdef BOOST_POSIX_API + + int file = open("/dev/urandom", O_RDONLY); + if (file == -1) + { + file = open("/dev/random", O_RDONLY); + if (file == -1) + { + fail(errno, ec); + return; + } + } + + size_t bytes_read = 0; + while (bytes_read < len) + { + ssize_t n = read(file, buf, len - bytes_read); + if (n == -1) + { + close(file); + fail(errno, ec); + return; + } + bytes_read += n; + buf = static_cast<char*>(buf) + n; + } + + close(file); + +# else // BOOST_WINDOWS_API + + HCRYPTPROV handle; + int errval = 0; + + if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, 0)) + { + errval = ::GetLastError(); + if (errval == NTE_BAD_KEYSET) + { + if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, CRYPT_NEWKEYSET)) + { + errval = ::GetLastError(); + } + else errval = 0; + } + } + + if (!errval) + { + BOOL gen_ok = ::CryptGenRandom(handle, len, static_cast<unsigned char*>(buf)); + if (!gen_ok) + errval = ::GetLastError(); + ::CryptReleaseContext(handle, 0); + } + + if (!errval) return; + + fail(errval, ec); +# endif +} + +} // unnamed namespace + +namespace boost { namespace filesystem3 { namespace detail { + +BOOST_FILESYSTEM_DECL +path unique_path(const path& model, system::error_code* ec) +{ + std::wstring s (model.wstring()); // std::string ng for MBCS encoded POSIX + const wchar_t hex[] = L"0123456789abcdef"; + const int n_ran = 16; + const int max_nibbles = 2 * n_ran; // 4-bits per nibble + char ran[n_ran]; + + int nibbles_used = max_nibbles; + for(std::wstring::size_type i=0; i < s.size(); ++i) + { + if (s[i] == L'%') // digit request + { + if (nibbles_used == max_nibbles) + { + system_crypt_random(ran, sizeof(ran), ec); + if (ec != 0 && *ec) + return ""; + nibbles_used = 0; + } + int c = ran[nibbles_used/2]; + c >>= 4 * (nibbles_used++ & 1); // if odd, shift right 1 nibble + s[i] = hex[c & 0xf]; // convert to hex digit and replace + } + } + + if (ec != 0) ec->clear(); + + return s; +} + +}}} + +#endif // no wide character support diff --git a/libs/filesystem/v3/src/utf8_codecvt_facet.cpp b/libs/filesystem/v3/src/utf8_codecvt_facet.cpp new file mode 100644 index 0000000000..ed0b422af8 --- /dev/null +++ b/libs/filesystem/v3/src/utf8_codecvt_facet.cpp @@ -0,0 +1,27 @@ +// Copyright Vladimir Prus 2004. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +// For HP-UX, request that WCHAR_MAX and WCHAR_MIN be defined as macros, +// not casts. See ticket 5048 +#define _INCLUDE_STDCSOURCE_199901 + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#define BOOST_FILESYSTEM_SOURCE +#include <boost/filesystem/config.hpp> + +#define BOOST_UTF8_BEGIN_NAMESPACE \ + namespace boost { namespace filesystem { namespace detail { + +#define BOOST_UTF8_END_NAMESPACE }}} +#define BOOST_UTF8_DECL BOOST_FILESYSTEM_DECL + +#include "libs/detail/utf8_codecvt_facet.cpp" + +#undef BOOST_UTF8_BEGIN_NAMESPACE +#undef BOOST_UTF8_END_NAMESPACE +#undef BOOST_UTF8_DECL diff --git a/libs/filesystem/v3/src/windows_file_codecvt.cpp b/libs/filesystem/v3/src/windows_file_codecvt.cpp new file mode 100644 index 0000000000..85de59eee1 --- /dev/null +++ b/libs/filesystem/v3/src/windows_file_codecvt.cpp @@ -0,0 +1,83 @@ +// filesystem windows_file_codecvt.cpp -----------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +#include <boost/config.hpp> +#if !defined( BOOST_NO_STD_WSTRING ) +// Boost.Filesystem V3 and later requires std::wstring support. +// During the transition to V3, libraries are compiled with both V2 and V3 sources. +// On old compilers that don't support V3 anyhow, we just skip everything so the compile +// will succeed and the library can be built. + +// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/v3/config.hpp> +#include <cwchar> // for mbstate_t + +#ifdef BOOST_WINDOWS_API + +#include "windows_file_codecvt.hpp" + +// Versions of MinGW prior to GCC 4.6 requires this +#ifndef WINVER +# define WINVER 0x0500 +#endif + +#include <windows.h> + + std::codecvt_base::result windows_file_codecvt::do_in( + std::mbstate_t &, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const + { + UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP; + + int count; + if ((count = ::MultiByteToWideChar(codepage, MB_PRECOMPOSED, from, + from_end - from, to, to_end - to)) == 0) + { + return error; // conversion failed + } + + from_next = from_end; + to_next = to + count; + *to_next = L'\0'; + return ok; + } + + std::codecvt_base::result windows_file_codecvt::do_out( + std::mbstate_t &, + const wchar_t* from, const wchar_t* from_end, const wchar_t* & from_next, + char* to, char* to_end, char* & to_next) const + { + UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP; + + int count; + if ((count = ::WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, from, + from_end - from, to, to_end - to, 0, 0)) == 0) + { + return error; // conversion failed + } + + from_next = from_end; + to_next = to + count; + *to_next = '\0'; + return ok; + } + + # endif // BOOST_WINDOWS_API + +#endif // no wide character support diff --git a/libs/filesystem/v3/src/windows_file_codecvt.hpp b/libs/filesystem/v3/src/windows_file_codecvt.hpp new file mode 100644 index 0000000000..d845d37942 --- /dev/null +++ b/libs/filesystem/v3/src/windows_file_codecvt.hpp @@ -0,0 +1,56 @@ +// filesystem windows_file_codecvt.hpp -----------------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#ifndef BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP +#define BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP + +#include <boost/filesystem/v3/config.hpp> +#include <locale> + + //------------------------------------------------------------------------------------// + // // + // class windows_file_codecvt // + // // + // Warning: partial implementation; even do_in and do_out only partially meet the // + // standard library specifications as the "to" buffer must hold the entire result. // + // // + //------------------------------------------------------------------------------------// + + class BOOST_FILESYSTEM_DECL windows_file_codecvt + : public std::codecvt< wchar_t, char, std::mbstate_t > + { + public: + explicit windows_file_codecvt() + : std::codecvt<wchar_t, char, std::mbstate_t>() {} + protected: + + virtual bool do_always_noconv() const throw() { return false; } + + // seems safest to assume variable number of characters since we don't + // actually know what codepage is active + virtual int do_encoding() const throw() { return 0; } + + virtual std::codecvt_base::result do_in(std::mbstate_t& state, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const; + + virtual std::codecvt_base::result do_out(std::mbstate_t & state, + const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, + char* to, char* to_end, char*& to_next) const; + + virtual std::codecvt_base::result do_unshift(std::mbstate_t&, + char* /*from*/, char* /*to*/, char* & /*next*/) const { return ok; } + + virtual int do_length(std::mbstate_t&, + const char* /*from*/, const char* /*from_end*/, std::size_t /*max*/) const { return 0; } + + virtual int do_max_length() const throw () { return 0; } + }; + +#endif // BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP diff --git a/libs/filesystem/v3/test/Jamfile.v2 b/libs/filesystem/v3/test/Jamfile.v2 new file mode 100644 index 0000000000..b076ffe8d2 --- /dev/null +++ b/libs/filesystem/v3/test/Jamfile.v2 @@ -0,0 +1,35 @@ +# Boost Filesystem Library test Jamfile + +# (C) Copyright Beman Dawes 2002-2006 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or www.boost.org/LICENSE_1_0.txt) + +project + : requirements + <library>/boost/filesystem//boost_filesystem + <library>/boost/system//boost_system + <toolset>msvc:<asynch-exceptions>on + ; + +# Some tests are run both statically and as shared libraries since it is helpful +# to know if failures in shared library tests are related to sharing or not. + + test-suite "filesystem" : + [ run path_unit_test.cpp : : : <link>shared ] + [ run path_unit_test.cpp : : : <link>static : path_unit_test_static ] + [ run path_test.cpp : : : <link>shared ] + [ run path_test.cpp : : : <link>static : path_test_static ] + [ run operations_unit_test.cpp : : : <link>shared ] + [ run operations_unit_test.cpp : : : <link>static : operations_unit_test_static ] + [ run operations_test.cpp : : : <link>shared ] + [ run operations_test.cpp : : : <link>static : operations_test_static ] + [ run fstream_test.cpp ] + [ run convenience_test.cpp ] + [ run large_file_support_test.cpp ] + [ run deprecated_test.cpp ] + [ run ../example/simple_ls.cpp ] + [ run ../example/file_status.cpp ] + +# [ compile ../example/mbcopy.cpp ] +# [ compile ../example/mbpath.cpp ] + ; diff --git a/libs/filesystem/v3/test/convenience_test.cpp b/libs/filesystem/v3/test/convenience_test.cpp new file mode 100644 index 0000000000..17675a6826 --- /dev/null +++ b/libs/filesystem/v3/test/convenience_test.cpp @@ -0,0 +1,180 @@ +// libs/filesystem/test/convenience_test.cpp -----------------------------------------// + +// Copyright Beman Dawes, 2002 +// Copyright Vladimir Prus, 2002 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/filesystem + +#define BOOST_FILESYSTEM_VERSION 3 + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/config/warning_disable.hpp> + +// See deprecated_test for tests of deprecated features +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +# define BOOST_FILESYSTEM_NO_DEPRECATED +#endif +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/convenience.hpp> +namespace fs = boost::filesystem; +using fs::path; +namespace sys = boost::system; + +#include <boost/detail/lightweight_test.hpp> +#include <boost/detail/lightweight_main.hpp> +#include <boost/bind.hpp> +#include <fstream> +#include <iostream> + +namespace +{ + template< typename F > + bool throws_fs_error(F func) + { + try { func(); } + + catch (const fs::filesystem_error &) + { + return true; + } + return false; + } + + void create_recursive_iterator(const fs::path & ph) + { + fs::recursive_directory_iterator it(ph); + } +} + +// ------------------------------------------------------------------------------------// + +int cpp_main(int, char*[]) +{ + +// create_directories() tests --------------------------------------------------------// + + BOOST_TEST(!fs::create_directories("")); // should be harmless + BOOST_TEST(!fs::create_directories("/")); // ditto + + path unique_dir = fs::unique_path(); // unique name in case tests running in parallel + path unique_yy = unique_dir / "yy"; + path unique_yya = unique_dir / "yya"; + path unique_yy_zz = unique_dir / "yy" / "zz"; + + fs::remove_all(unique_dir); // make sure slate is blank + BOOST_TEST(!fs::exists(unique_dir)); // reality check + + BOOST_TEST(fs::create_directories(unique_dir)); + BOOST_TEST(fs::exists(unique_dir)); + BOOST_TEST(fs::is_directory(unique_dir)); + + BOOST_TEST(fs::create_directories(unique_yy_zz)); + BOOST_TEST(fs::exists(unique_dir)); + BOOST_TEST(fs::exists(unique_yy)); + BOOST_TEST(fs::exists(unique_yy_zz)); + BOOST_TEST(fs::is_directory(unique_dir)); + BOOST_TEST(fs::is_directory(unique_yy)); + BOOST_TEST(fs::is_directory(unique_yy_zz)); + + path is_a_file(unique_dir / "uu"); + { + std::ofstream f(is_a_file.string().c_str()); + BOOST_TEST(!!f); + } + BOOST_TEST(throws_fs_error( + boost::bind(fs::create_directories, is_a_file))); + BOOST_TEST(throws_fs_error( + boost::bind(fs::create_directories, is_a_file / "aa"))); + +// recursive_directory_iterator tests ----------------------------------------// + + sys::error_code ec; + fs::recursive_directory_iterator it("/no-such-path", ec); + BOOST_TEST(ec); + + BOOST_TEST(throws_fs_error( + boost::bind(create_recursive_iterator, "/no-such-path"))); + + fs::remove(unique_dir / "uu"); + +#ifdef BOOST_WINDOWS_API + // These tests depends on ordering of directory entries, and that's guaranteed + // on Windows but not necessarily on other operating systems + { + std::ofstream f(unique_yya.string().c_str()); + BOOST_TEST(!!f); + } + + for (it = fs::recursive_directory_iterator(unique_dir); + it != fs::recursive_directory_iterator(); ++it) + { std::cout << it->path() << '\n'; } + + it = fs::recursive_directory_iterator(unique_dir); + BOOST_TEST(it->path() == unique_yy); + BOOST_TEST(it.level() == 0); + ++it; + BOOST_TEST(it->path() == unique_yy_zz); + BOOST_TEST(it.level() == 1); + it.pop(); + BOOST_TEST(it->path() == unique_yya); + BOOST_TEST(it.level() == 0); + it++; + BOOST_TEST(it == fs::recursive_directory_iterator()); + + it = fs::recursive_directory_iterator(unique_dir); + BOOST_TEST(it->path() == unique_yy); + it.no_push(); + ++it; + BOOST_TEST(it->path() == unique_yya); + ++it; + BOOST_TEST(it == fs::recursive_directory_iterator()); + + fs::remove(unique_yya); +#endif + + it = fs::recursive_directory_iterator(unique_yy_zz); + BOOST_TEST(it == fs::recursive_directory_iterator()); + + it = fs::recursive_directory_iterator(unique_dir); + BOOST_TEST(it->path() == unique_yy); + BOOST_TEST(it.level() == 0); + ++it; + BOOST_TEST(it->path() == unique_yy_zz); + BOOST_TEST(it.level() == 1); + it++; + BOOST_TEST(it == fs::recursive_directory_iterator()); + + it = fs::recursive_directory_iterator(unique_dir); + BOOST_TEST(it->path() == unique_yy); + it.no_push(); + ++it; + BOOST_TEST(it == fs::recursive_directory_iterator()); + + it = fs::recursive_directory_iterator(unique_dir); + BOOST_TEST(it->path() == unique_yy); + ++it; + it.pop(); + BOOST_TEST(it == fs::recursive_directory_iterator()); + + ec.clear(); + BOOST_TEST(!ec); + // check that two argument failed constructor creates the end iterator + BOOST_TEST(fs::recursive_directory_iterator("nosuchdir", ec) + == fs::recursive_directory_iterator()); + BOOST_TEST(ec); + + fs::remove_all(unique_dir); // clean up behind ourselves + + return ::boost::report_errors(); +} diff --git a/libs/filesystem/v3/test/deprecated_test.cpp b/libs/filesystem/v3/test/deprecated_test.cpp new file mode 100644 index 0000000000..de82ff8b26 --- /dev/null +++ b/libs/filesystem/v3/test/deprecated_test.cpp @@ -0,0 +1,251 @@ +// deprecated_test program --------------------------------------------------// + +// Copyright Beman Dawes 2002 +// Copyright Vladimir Prus 2002 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +// This test verifies that various deprecated names still work. This is +// important to preserve existing code that uses the old names. + +#define BOOST_FILESYSTEM_VERSION 3 + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#define BOOST_FILESYSTEM_DEPRECATED + +#include <boost/filesystem.hpp> +#include <boost/detail/lightweight_test.hpp> +#include <boost/detail/lightweight_main.hpp> + +namespace fs = boost::filesystem; +using boost::filesystem::path; + +#define PATH_CHECK(a, b) check(a, b, __LINE__) + +namespace +{ + std::string platform(BOOST_PLATFORM); + + void check(const fs::path & source, + const std::string & expected, int line) + { + if (source.generic_string()== expected) return; + + ++::boost::detail::test_errors(); + + std::cout << '(' << line << ") source.string(): \"" << source.string() + << "\" != expected: \"" << expected + << "\"" << std::endl; + } + + void normalize_test() + { + PATH_CHECK(path("").normalize(), ""); + PATH_CHECK(path("/").normalize(), "/"); + PATH_CHECK(path("//").normalize(), "//"); + PATH_CHECK(path("///").normalize(), "/"); + PATH_CHECK(path("f").normalize(), "f"); + PATH_CHECK(path("foo").normalize(), "foo"); + PATH_CHECK(path("foo/").normalize(), "foo/."); + PATH_CHECK(path("f/").normalize(), "f/."); + PATH_CHECK(path("/foo").normalize(), "/foo"); + PATH_CHECK(path("foo/bar").normalize(), "foo/bar"); + PATH_CHECK(path("..").normalize(), ".."); + PATH_CHECK(path("../..").normalize(), "../.."); + PATH_CHECK(path("/..").normalize(), "/.."); + PATH_CHECK(path("/../..").normalize(), "/../.."); + PATH_CHECK(path("../foo").normalize(), "../foo"); + PATH_CHECK(path("foo/..").normalize(), "."); + PATH_CHECK(path("foo/../").normalize(), "./."); + PATH_CHECK((path("foo") / "..").normalize() , "."); + PATH_CHECK(path("foo/...").normalize(), "foo/..."); + PATH_CHECK(path("foo/.../").normalize(), "foo/.../."); + PATH_CHECK(path("foo/..bar").normalize(), "foo/..bar"); + PATH_CHECK(path("../f").normalize(), "../f"); + PATH_CHECK(path("/../f").normalize(), "/../f"); + PATH_CHECK(path("f/..").normalize(), "."); + PATH_CHECK((path("f") / "..").normalize() , "."); + PATH_CHECK(path("foo/../..").normalize(), ".."); + PATH_CHECK(path("foo/../../").normalize(), "../."); + PATH_CHECK(path("foo/../../..").normalize(), "../.."); + PATH_CHECK(path("foo/../../../").normalize(), "../../."); + PATH_CHECK(path("foo/../bar").normalize(), "bar"); + PATH_CHECK(path("foo/../bar/").normalize(), "bar/."); + PATH_CHECK(path("foo/bar/..").normalize(), "foo"); + PATH_CHECK(path("foo/bar/../").normalize(), "foo/."); + PATH_CHECK(path("foo/bar/../..").normalize(), "."); + PATH_CHECK(path("foo/bar/../../").normalize(), "./."); + PATH_CHECK(path("foo/bar/../blah").normalize(), "foo/blah"); + PATH_CHECK(path("f/../b").normalize(), "b"); + PATH_CHECK(path("f/b/..").normalize(), "f"); + PATH_CHECK(path("f/b/../").normalize(), "f/."); + PATH_CHECK(path("f/b/../a").normalize(), "f/a"); + PATH_CHECK(path("foo/bar/blah/../..").normalize(), "foo"); + PATH_CHECK(path("foo/bar/blah/../../bletch").normalize(), "foo/bletch"); + PATH_CHECK(path("//net").normalize(), "//net"); + PATH_CHECK(path("//net/").normalize(), "//net/"); + PATH_CHECK(path("//..net").normalize(), "//..net"); + PATH_CHECK(path("//net/..").normalize(), "//net/.."); + PATH_CHECK(path("//net/foo").normalize(), "//net/foo"); + PATH_CHECK(path("//net/foo/").normalize(), "//net/foo/."); + PATH_CHECK(path("//net/foo/..").normalize(), "//net/"); + PATH_CHECK(path("//net/foo/../").normalize(), "//net/."); + + PATH_CHECK(path("/net/foo/bar").normalize(), "/net/foo/bar"); + PATH_CHECK(path("/net/foo/bar/").normalize(), "/net/foo/bar/."); + PATH_CHECK(path("/net/foo/..").normalize(), "/net"); + PATH_CHECK(path("/net/foo/../").normalize(), "/net/."); + + PATH_CHECK(path("//net//foo//bar").normalize(), "//net/foo/bar"); + PATH_CHECK(path("//net//foo//bar//").normalize(), "//net/foo/bar/."); + PATH_CHECK(path("//net//foo//..").normalize(), "//net/"); + PATH_CHECK(path("//net//foo//..//").normalize(), "//net/."); + + PATH_CHECK(path("///net///foo///bar").normalize(), "/net/foo/bar"); + PATH_CHECK(path("///net///foo///bar///").normalize(), "/net/foo/bar/."); + PATH_CHECK(path("///net///foo///..").normalize(), "/net"); + PATH_CHECK(path("///net///foo///..///").normalize(), "/net/."); + + if (platform == "Windows") + { + PATH_CHECK(path("c:..").normalize(), "c:.."); + PATH_CHECK(path("c:foo/..").normalize(), "c:"); + + PATH_CHECK(path("c:foo/../").normalize(), "c:."); + + PATH_CHECK(path("c:/foo/..").normalize(), "c:/"); + PATH_CHECK(path("c:/foo/../").normalize(), "c:/."); + PATH_CHECK(path("c:/..").normalize(), "c:/.."); + PATH_CHECK(path("c:/../").normalize(), "c:/../."); + PATH_CHECK(path("c:/../..").normalize(), "c:/../.."); + PATH_CHECK(path("c:/../../").normalize(), "c:/../../."); + PATH_CHECK(path("c:/../foo").normalize(), "c:/../foo"); + PATH_CHECK(path("c:/../foo/").normalize(), "c:/../foo/."); + PATH_CHECK(path("c:/../../foo").normalize(), "c:/../../foo"); + PATH_CHECK(path("c:/../../foo/").normalize(), "c:/../../foo/."); + PATH_CHECK(path("c:/..foo").normalize(), "c:/..foo"); + } + else // POSIX + { + PATH_CHECK(path("c:..").normalize(), "c:.."); + PATH_CHECK(path("c:foo/..").normalize(), "."); + PATH_CHECK(path("c:foo/../").normalize(), "./."); + PATH_CHECK(path("c:/foo/..").normalize(), "c:"); + PATH_CHECK(path("c:/foo/../").normalize(), "c:/."); + PATH_CHECK(path("c:/..").normalize(), "."); + PATH_CHECK(path("c:/../").normalize(), "./."); + PATH_CHECK(path("c:/../..").normalize(), ".."); + PATH_CHECK(path("c:/../../").normalize(), "../."); + PATH_CHECK(path("c:/../foo").normalize(), "foo"); + PATH_CHECK(path("c:/../foo/").normalize(), "foo/."); + PATH_CHECK(path("c:/../../foo").normalize(), "../foo"); + PATH_CHECK(path("c:/../../foo/").normalize(), "../foo/."); + PATH_CHECK(path("c:/..foo").normalize(), "c:/..foo"); + } + } + + // Compile-only tests not intended to be executed -----------------------------------// + + void compile_only() + { + fs::path p; + + fs::initial_path<fs::path>(); + fs::initial_path<fs::wpath>(); + + p.file_string(); + p.directory_string(); + } + + // path_rename_test -----------------------------------------------------------------// + + void path_rename_test() + { + fs::path p("foo/bar/blah"); + + BOOST_TEST_EQ(path("foo/bar/blah").remove_leaf(), "foo/bar"); + BOOST_TEST_EQ(p.leaf(), "blah"); + BOOST_TEST_EQ(p.branch_path(), "foo/bar"); + BOOST_TEST(p.has_leaf()); + BOOST_TEST(p.has_branch_path()); + BOOST_TEST(!p.is_complete()); + + if (platform == "Windows") + { + BOOST_TEST_EQ(path("foo\\bar\\blah").remove_leaf(), "foo\\bar"); + p = "foo\\bar\\blah"; + BOOST_TEST_EQ(p.branch_path(), "foo\\bar"); + } + } + +} // unnamed namespace + + +//--------------------------------------------------------------------------------------// + +int cpp_main(int /*argc*/, char* /*argv*/[]) +{ + // The choice of platform is make at runtime rather than compile-time + // so that compile errors for all platforms will be detected even though + // only the current platform is runtime tested. + platform = (platform == "Win32" || platform == "Win64" || platform == "Cygwin") + ? "Windows" + : "POSIX"; + std::cout << "Platform is " << platform << '\n'; + + BOOST_TEST(fs::initial_path() == fs::current_path()); + + //path::default_name_check(fs::no_check); + + fs::directory_entry de("foo/bar"); + + de.replace_leaf("", fs::file_status(), fs::file_status()); + + //de.leaf(); + //de.string(); + + fs::path ng(" no-way, Jose"); + BOOST_TEST(!fs::is_regular(ng)); // verify deprecated name still works + BOOST_TEST(!fs::symbolic_link_exists("nosuchfileordirectory")); + + path_rename_test(); + normalize_test(); + +// extension() tests ---------------------------------------------------------// + + BOOST_TEST(fs::extension("a/b") == ""); + BOOST_TEST(fs::extension("a/b.txt") == ".txt"); + BOOST_TEST(fs::extension("a/b.") == "."); + BOOST_TEST(fs::extension("a.b.c") == ".c"); + BOOST_TEST(fs::extension("a.b.c.") == "."); + BOOST_TEST(fs::extension("") == ""); + BOOST_TEST(fs::extension("a/") == ""); + +// basename() tests ----------------------------------------------------------// + + BOOST_TEST(fs::basename("b") == "b"); + BOOST_TEST(fs::basename("a/b.txt") == "b"); + BOOST_TEST(fs::basename("a/b.") == "b"); + BOOST_TEST(fs::basename("a.b.c") == "a.b"); + BOOST_TEST(fs::basename("a.b.c.") == "a.b.c"); + BOOST_TEST(fs::basename("") == ""); + +// change_extension tests ---------------------------------------------------// + + BOOST_TEST(fs::change_extension("a.txt", ".tex").string() == "a.tex"); + BOOST_TEST(fs::change_extension("a.", ".tex").string() == "a.tex"); + BOOST_TEST(fs::change_extension("a", ".txt").string() == "a.txt"); + BOOST_TEST(fs::change_extension("a.b.txt", ".tex").string() == "a.b.tex"); + // see the rationale in html docs for explanation why this works + BOOST_TEST(fs::change_extension("", ".png").string() == ".png"); + + return ::boost::report_errors(); +} diff --git a/libs/filesystem/v3/test/design_use_cases.cpp b/libs/filesystem/v3/test/design_use_cases.cpp new file mode 100644 index 0000000000..49b0c28c08 --- /dev/null +++ b/libs/filesystem/v3/test/design_use_cases.cpp @@ -0,0 +1,81 @@ +#include <string> +#include <iostream> + +// Minimal class path + +class path +{ +public: + path( const char * ) + { + std::cout << "path( const char * )\n"; + } + path( const std::string & ) + { + std::cout << "path( std::string & )\n"; + } + +// for maximum efficiency, either signature must work +# ifdef BY_VALUE + operator const std::string() const +# else + operator const std::string&() const +# endif + { + std::cout << "operator string\n"; + return m_path; + } + +#ifdef NAMED_CONVERSION + std::string string() const + { + std::cout << "std::string string() const\n"; + return m_path; + } +#endif + +private: + std::string m_path; +}; + +bool operator==( const path &, const path & ) +{ + std::cout << "operator==( const path &, const path & )\n"; + return true; +} + +// These are the critical use cases. If any of these don't compile, usability +// is unacceptably degraded. + +void f( const path & ) +{ + std::cout << "f( const path & )\n"; +} + +int main() +{ + f( "foo" ); + f( std::string( "foo" ) ); + f( path( "foo" ) ); + + std::cout << '\n'; + + std::string s1( path( "foo" ) ); + std::string s2 = path( "foo" ); + s2 = path( "foo" ); + +#ifdef NAMED_CONVERSION + s2 = path( "foo" ).string(); +#endif + + std::cout << '\n'; + + // these must call bool path( const path &, const path & ); + path( "foo" ) == path( "foo" ); + path( "foo" ) == "foo"; + path( "foo" ) == std::string( "foo" ); + "foo" == path( "foo" ); + std::string( "foo" ) == path( "foo" ); + + return 0; +} diff --git a/libs/filesystem/v3/test/equivalent.cpp b/libs/filesystem/v3/test/equivalent.cpp new file mode 100644 index 0000000000..be3089afd6 --- /dev/null +++ b/libs/filesystem/v3/test/equivalent.cpp @@ -0,0 +1,39 @@ +// equivalent program -------------------------------------------------------// + +// Copyright (c) 2004 Beman Dawes + +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy +// at http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/filesystem + +//----------------------------------------------------------------------------// + +#include <boost/filesystem/operations.hpp> +#include <iostream> +#include <exception> + +int main( int argc, char * argv[] ) +{ + boost::filesystem::path::default_name_check( boost::filesystem::native ); + if ( argc != 3 ) + { + std::cout << "Usage: equivalent path1 path2\n"; + return 2; + } + + bool eq; + try + { + eq = boost::filesystem::equivalent( argv[1], argv[2] ); + } + catch ( const std::exception & ex ) + { + std::cout << ex.what() << "\n"; + return 3; + } + + std::cout << (eq ? "Paths are equivalent\n" : "Paths are not equivalent\n"); + return !eq; +} diff --git a/libs/filesystem/v3/test/fstream_test.cpp b/libs/filesystem/v3/test/fstream_test.cpp new file mode 100644 index 0000000000..d194033ff8 --- /dev/null +++ b/libs/filesystem/v3/test/fstream_test.cpp @@ -0,0 +1,173 @@ +// fstream_test.cpp ------------------------------------------------------------------// + +// Copyright Beman Dawes 2002 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#define BOOST_FILESYSTEM_VERSION 3 + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/config/warning_disable.hpp> + +// See deprecated_test for tests of deprecated features +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +# define BOOST_FILESYSTEM_NO_DEPRECATED +#endif +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/fstream.hpp> +#include <boost/filesystem/operations.hpp> +#include <string> +#include <iostream> +#include <cstdio> // for std::remove + +#include <boost/filesystem/detail/utf8_codecvt_facet.hpp> + +namespace fs = boost::filesystem; + +#include <boost/config.hpp> +#ifdef BOOST_NO_STDC_NAMESPACE + namespace std { using ::remove; } +#endif + +#include <boost/detail/lightweight_test.hpp> +#include <boost/detail/lightweight_main.hpp> + +#if defined(_MSC_VER) +# pragma warning(push) // Save warning settings. +# pragma warning(disable : 4428) // Disable universal-character-name encountered in source warning. +#endif + +namespace +{ + bool cleanup = true; + + void test(const fs::path & p) + { + fs::remove(p); + { + std::cout << " in test 1\n"; + fs::filebuf fb1; + fb1.open(p, std::ios_base::out); + BOOST_TEST(fb1.is_open()); + } + { + std::cout << " in test 2\n"; + fs::filebuf fb2; + fb2.open(p, std::ios_base::in); + BOOST_TEST(fb2.is_open()); + } + { + std::cout << " in test 3\n"; + fs::ifstream tfs(p); + BOOST_TEST(tfs.is_open()); + } + { + std::cout << " in test 4\n"; + fs::ifstream tfs(p / p.filename()); // should fail + BOOST_TEST(!tfs.is_open()); + } + { + std::cout << " in test 5\n"; + fs::ifstream tfs(p, std::ios_base::in); + BOOST_TEST(tfs.is_open()); + } + { + std::cout << " in test 6\n"; + fs::ifstream tfs; + tfs.open(p); + BOOST_TEST(tfs.is_open()); + } + { + std::cout << " in test 7\n"; + fs::ifstream tfs; + tfs.open(p, std::ios_base::in); + BOOST_TEST(tfs.is_open()); + } + { + std::cout << " in test 8\n"; + fs::ofstream tfs(p); + BOOST_TEST(tfs.is_open()); + } + { + std::cout << " in test 9\n"; + fs::ofstream tfs(p, std::ios_base::out); + BOOST_TEST(tfs.is_open()); + } + { + std::cout << " in test 10\n"; + fs::ofstream tfs; + tfs.open(p); + BOOST_TEST(tfs.is_open()); + } + { + std::cout << " in test 11\n"; + fs::ofstream tfs; + tfs.open(p, std::ios_base::out); + BOOST_TEST(tfs.is_open()); + } + { + std::cout << " in test 12\n"; + fs::fstream tfs(p); + BOOST_TEST(tfs.is_open()); + } + { + std::cout << " in test 13\n"; + fs::fstream tfs(p, std::ios_base::in|std::ios_base::out); + BOOST_TEST(tfs.is_open()); + } + { + std::cout << " in test 14\n"; + fs::fstream tfs; + tfs.open(p); + BOOST_TEST(tfs.is_open()); + } + { + std::cout << " in test 15\n"; + fs::fstream tfs; + tfs.open(p, std::ios_base::in|std::ios_base::out); + BOOST_TEST(tfs.is_open()); + } + + if (cleanup) + fs::remove(p); + + } // test +} // unnamed namespace + +int cpp_main(int argc, char*[]) +{ + if (argc > 1) cleanup = false; + + std::cout << "BOOST_FILESYSTEM_C_STR defined as \"" + << BOOST_STRINGIZE(BOOST_FILESYSTEM_C_STR) << "\"\n"; + + // test narrow characters + std::cout << "narrow character tests:\n"; + test("v3_fstream_test"); + + + // So that tests are run with known encoding, use Boost UTF-8 codecvt + std::locale global_loc = std::locale(); + std::locale loc(global_loc, new fs::detail::utf8_codecvt_facet); + fs::path::imbue(loc); + + // test with some wide characters + // \u2780 is circled 1 against white background == e2 9e 80 in UTF-8 + // \u2781 is circled 2 against white background == e2 9e 81 in UTF-8 + // \u263A is a white smiling face + std::cout << "\nwide character tests:\n"; + test(L"fstream_test_\u2780\u263A"); + + return ::boost::report_errors(); +} diff --git a/libs/filesystem/v3/test/large_file_support_test.cpp b/libs/filesystem/v3/test/large_file_support_test.cpp new file mode 100644 index 0000000000..287490efea --- /dev/null +++ b/libs/filesystem/v3/test/large_file_support_test.cpp @@ -0,0 +1,45 @@ +// Boost large_file_support_test.cpp ---------------------------------------// + +// Copyright Beman Dawes 2004. +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/filesystem + + +#define BOOST_FILESYSTEM_VERSION 3 + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +// See deprecated_test for tests of deprecated features +#define BOOST_FILESYSTEM_NO_DEPRECATED +#define BOOST_SYSTEM_NO_DEPRECATED + +#include <boost/filesystem/operations.hpp> +namespace fs = boost::filesystem; + +#include <iostream> + +int main() +{ + if ( fs::detail::possible_large_file_size_support() ) + { + std::cout << "It appears that file sizes greater that 2 gigabytes are possible\n" + "for this configuration on this platform since the operating system\n" + "does use a large enough integer type to report large file sizes.\n\n" + "Whether or not such support is actually present depends on the OS\n"; + return 0; + } + std::cout << "The operating system is using an integer type to report file sizes\n" + "that can not represent file sizes greater that 2 gigabytes (31-bits).\n" + "Thus the Filesystem Library will not correctly deal with such large\n" + "files. If you think that this operatiing system should be able to\n" + "support large files, please report the problem to the Boost developers\n" + "mailing list.\n"; + return 1; +} diff --git a/libs/filesystem/v3/test/locale_info.cpp b/libs/filesystem/v3/test/locale_info.cpp new file mode 100644 index 0000000000..db57bb1588 --- /dev/null +++ b/libs/filesystem/v3/test/locale_info.cpp @@ -0,0 +1,88 @@ +// locale_info.cpp ---------------------------------------------------------// + +// Copyright Beman Dawes 2011 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#include <locale> +#include <iostream> +#include <exception> +#include <cstdlib> +using namespace std; + +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4996) // ... Function call with parameters that may be unsafe +#endif + +namespace +{ + void facet_info(const locale& loc, const char* msg) + { + cout << "has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(" + << msg << ") is " + << (has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc) + ? "true\n" + : "false\n"); + } + + void default_info() + { + try + { + locale loc; + cout << "\nlocale default construction OK" << endl; + facet_info(loc, "locale()"); + } + catch (const exception& ex) + { + cout << "\nlocale default construction threw: " << ex.what() << endl; + } + } + + void null_string_info() + { + try + { + locale loc(""); + cout << "\nlocale(\"\") construction OK" << endl; + facet_info(loc, "locale(\"\")"); + } + catch (const exception& ex) + { + cout << "\nlocale(\"\") construction threw: " << ex.what() << endl; + } + } + + void classic_info() + { + try + { + locale loc(locale::classic()); + cout << "\nlocale(locale::classic()) copy construction OK" << endl; + facet_info(loc, "locale::classic()"); + } + catch (const exception& ex) + { + cout << "\nlocale(locale::clasic()) copy construction threw: " << ex.what() << endl; + } + } +} + +int main() +{ + const char* lang = getenv("LANG"); + cout << "\nLANG environmental variable is " + << (lang ? lang : "not present") << endl; + + default_info(); + null_string_info(); + classic_info(); + + return 0; +} + +#ifdef _MSC_VER +# pragma warning(pop) +#endif diff --git a/libs/filesystem/v3/test/long_path_test.cpp b/libs/filesystem/v3/test/long_path_test.cpp new file mode 100644 index 0000000000..65be7cb4e1 --- /dev/null +++ b/libs/filesystem/v3/test/long_path_test.cpp @@ -0,0 +1,61 @@ +// long_path_test.cpp ----------------------------------------------------------------// + +// Copyright Beman Dawes 2011 + +// Distributed under the Boost Software License, Version 1.0. +// http://www.boost.org/LICENSE_1_0.txt + +// See http://www.boost.org/libs/btree for documentation. + +// See http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx + +#define BOOST_FILESYSTEM_VERSION 3 + +#include <boost/config/warning_disable.hpp> + +#include <boost/filesystem.hpp> +#include <iostream> +#include <string> + +using namespace boost::filesystem; + +#include <boost/detail/lightweight_test.hpp> +#include <boost/detail/lightweight_main.hpp> + +namespace +{ +} // unnamed namespace + +int cpp_main(int, char*[]) +{ + + std::string prefix("d:\\temp\\"); + std::cout << "prefix is " << prefix << '\n'; + + const std::size_t safe_size + = 260 - prefix.size() - 100; // Windows MAX_PATH is 260 + + std::string safe_x_string(safe_size, 'x'); + std::string safe_y_string(safe_size, 'y'); + std::string path_escape("\\\\?\\"); + + path x_p(prefix + safe_x_string); + path y_p(path_escape + prefix + safe_x_string + "\\" + safe_y_string); + + std::cout << "x_p.native().size() is " << x_p.native().size() << '\n'; + std::cout << "y_p.native().size() is " << y_p.native().size() << '\n'; + + create_directory(x_p); + BOOST_TEST(exists(x_p)); + create_directory(y_p); + BOOST_TEST(exists(y_p)); + + //std::cout << "directory x.../y... ready for testing, where ... is " << safe_size + // << " repeats of x and y, respectively\n"; + + BOOST_TEST(exists(x_p)); + + //remove_all(x_p); + + return ::boost::report_errors(); +} diff --git a/libs/filesystem/v3/test/msvc/common.vsprops b/libs/filesystem/v3/test/msvc/common.vsprops new file mode 100644 index 0000000000..9820ca15cf --- /dev/null +++ b/libs/filesystem/v3/test/msvc/common.vsprops @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="common" + OutputDirectory="$(TEMP)\$(SolutionName)\$(ConfigurationName)" + IntermediateDirectory="$(TEMP)\$(SolutionName)\$(ProjectName)\$(ConfigurationName)" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="../../../../../.." + PreprocessorDefinitions="BOOST_FILESYSTEM_VERSION=3;BOOST_SYSTEM_NO_DEPRECATED;BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK" + ExceptionHandling="2" + DisableLanguageExtensions="false" + WarningLevel="4" + /> + <Tool + Name="VCLinkerTool" + AdditionalLibraryDirectories="" + /> +</VisualStudioPropertySheet> diff --git a/libs/filesystem/v3/test/msvc/convenience_test/convenience_test.vcproj b/libs/filesystem/v3/test/msvc/convenience_test/convenience_test.vcproj new file mode 100644 index 0000000000..49435cf50b --- /dev/null +++ b/libs/filesystem/v3/test/msvc/convenience_test/convenience_test.vcproj @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="convenience_test" + ProjectGUID="{08986FB5-0C83-4BC4-92DF-05E12E1C03C1}" + RootNamespace="convenience_test" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\convenience_test.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/deprecated_test/deprecated_test.vcproj b/libs/filesystem/v3/test/msvc/deprecated_test/deprecated_test.vcproj new file mode 100644 index 0000000000..c0b3ecdc4b --- /dev/null +++ b/libs/filesystem/v3/test/msvc/deprecated_test/deprecated_test.vcproj @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="deprecated_test" + ProjectGUID="{D73BC50F-956E-4A44-BF9F-A8BB80DF0000}" + RootNamespace="deprecated_test" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="BOOST_ALL_NO_LIB;BOOST_SYSTEM_DYN_LINK;BOOST_FILESYSTEM_DYN_LINK;WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="BOOST_ALL_NO_LIB;BOOST_SYSTEM_DYN_LINK;BOOST_FILESYSTEM_DYN_LINK;WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\deprecated_test.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/error_demo/error_demo.vcproj b/libs/filesystem/v3/test/msvc/error_demo/error_demo.vcproj new file mode 100644 index 0000000000..91e29843b6 --- /dev/null +++ b/libs/filesystem/v3/test/msvc/error_demo/error_demo.vcproj @@ -0,0 +1,191 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="error_demo" + ProjectGUID="{709A954B-4F1E-4375-A418-BCBFFE598715}" + RootNamespace="error_demo" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\..\example\error_demo.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/filesystem-v3.sln b/libs/filesystem/v3/test/msvc/filesystem-v3.sln new file mode 100644 index 0000000000..344008b924 --- /dev/null +++ b/libs/filesystem/v3/test/msvc/filesystem-v3.sln @@ -0,0 +1,173 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "path_unit_test", "path_unit_test\path_unit_test.vcproj", "{3C77F610-2E31-4087-9DF2-7CD45198A02D}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "operations_unit_test", "operations_unit_test\operations_unit_test.vcproj", "{5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "operations_test", "operations_test\operations_test.vcproj", "{8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "path_test", "path_test\path_test.vcproj", "{F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "system_dll", "system_dll\system_dll.vcproj", "{F94CCADD-A90B-480C-A304-C19D015D36B1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filesystem_dll", "filesystem_dll\filesystem_dll.vcproj", "{FFD738F7-96F0-445C-81EA-551665EF53D1}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convenience_test", "convenience_test\convenience_test.vcproj", "{08986FB5-0C83-4BC4-92DF-05E12E1C03C1}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fstream_test", "fstream_test\fstream_test.vcproj", "{A9939CD7-BE1C-4334-947C-4C320D49B3CA}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "deprecated_test", "deprecated_test\deprecated_test.vcproj", "{D73BC50F-956E-4A44-BF9F-A8BB80DF0000}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_ls", "simple_ls\simple_ls.vcproj", "{6B8EC880-702E-418A-BC63-CA46C6CC7B27}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "error_demo", "error_demo\error_demo.vcproj", "{709A954B-4F1E-4375-A418-BCBFFE598715}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut1", "tut1\tut1.vcproj", "{6376B8E4-7FD4-466B-978E-E8DA6E938689}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut3", "tut3\tut3.vcproj", "{4FF64FA7-6806-401D-865C-79DD064D4A9E}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut2", "tut2\tut2.vcproj", "{CD69B175-389E-4F8F-85DC-03C56A47CD1D}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut4", "tut4\tut4.vcproj", "{256EA89A-E073-4CE8-B675-BE2FBC6B2691}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hebrew_example", "hebrew_example\hebrew_example.vcproj", "{F9F236A2-8B57-415A-8397-7145144400F5}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "enable_if_test", "enable_if_test\enable_if_test.vcproj", "{03FC7556-1052-45FF-A162-90D595713EAB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3C77F610-2E31-4087-9DF2-7CD45198A02D}.Debug|Win32.ActiveCfg = Debug|Win32 + {3C77F610-2E31-4087-9DF2-7CD45198A02D}.Debug|Win32.Build.0 = Debug|Win32 + {3C77F610-2E31-4087-9DF2-7CD45198A02D}.Release|Win32.ActiveCfg = Release|Win32 + {3C77F610-2E31-4087-9DF2-7CD45198A02D}.Release|Win32.Build.0 = Release|Win32 + {5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}.Debug|Win32.ActiveCfg = Debug|Win32 + {5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}.Debug|Win32.Build.0 = Debug|Win32 + {5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}.Release|Win32.ActiveCfg = Release|Win32 + {5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}.Release|Win32.Build.0 = Release|Win32 + {8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}.Debug|Win32.ActiveCfg = Debug|Win32 + {8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}.Debug|Win32.Build.0 = Debug|Win32 + {8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}.Release|Win32.ActiveCfg = Release|Win32 + {8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}.Release|Win32.Build.0 = Release|Win32 + {F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}.Debug|Win32.ActiveCfg = Debug|Win32 + {F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}.Debug|Win32.Build.0 = Debug|Win32 + {F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}.Release|Win32.ActiveCfg = Release|Win32 + {F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}.Release|Win32.Build.0 = Release|Win32 + {F94CCADD-A90B-480C-A304-C19D015D36B1}.Debug|Win32.ActiveCfg = Debug|Win32 + {F94CCADD-A90B-480C-A304-C19D015D36B1}.Debug|Win32.Build.0 = Debug|Win32 + {F94CCADD-A90B-480C-A304-C19D015D36B1}.Release|Win32.ActiveCfg = Release|Win32 + {F94CCADD-A90B-480C-A304-C19D015D36B1}.Release|Win32.Build.0 = Release|Win32 + {FFD738F7-96F0-445C-81EA-551665EF53D1}.Debug|Win32.ActiveCfg = Debug|Win32 + {FFD738F7-96F0-445C-81EA-551665EF53D1}.Debug|Win32.Build.0 = Debug|Win32 + {FFD738F7-96F0-445C-81EA-551665EF53D1}.Release|Win32.ActiveCfg = Release|Win32 + {FFD738F7-96F0-445C-81EA-551665EF53D1}.Release|Win32.Build.0 = Release|Win32 + {08986FB5-0C83-4BC4-92DF-05E12E1C03C1}.Debug|Win32.ActiveCfg = Debug|Win32 + {08986FB5-0C83-4BC4-92DF-05E12E1C03C1}.Debug|Win32.Build.0 = Debug|Win32 + {08986FB5-0C83-4BC4-92DF-05E12E1C03C1}.Release|Win32.ActiveCfg = Release|Win32 + {08986FB5-0C83-4BC4-92DF-05E12E1C03C1}.Release|Win32.Build.0 = Release|Win32 + {A9939CD7-BE1C-4334-947C-4C320D49B3CA}.Debug|Win32.ActiveCfg = Debug|Win32 + {A9939CD7-BE1C-4334-947C-4C320D49B3CA}.Debug|Win32.Build.0 = Debug|Win32 + {A9939CD7-BE1C-4334-947C-4C320D49B3CA}.Release|Win32.ActiveCfg = Release|Win32 + {A9939CD7-BE1C-4334-947C-4C320D49B3CA}.Release|Win32.Build.0 = Release|Win32 + {D73BC50F-956E-4A44-BF9F-A8BB80DF0000}.Debug|Win32.ActiveCfg = Debug|Win32 + {D73BC50F-956E-4A44-BF9F-A8BB80DF0000}.Debug|Win32.Build.0 = Debug|Win32 + {D73BC50F-956E-4A44-BF9F-A8BB80DF0000}.Release|Win32.ActiveCfg = Release|Win32 + {D73BC50F-956E-4A44-BF9F-A8BB80DF0000}.Release|Win32.Build.0 = Release|Win32 + {6B8EC880-702E-418A-BC63-CA46C6CC7B27}.Debug|Win32.ActiveCfg = Debug|Win32 + {6B8EC880-702E-418A-BC63-CA46C6CC7B27}.Debug|Win32.Build.0 = Debug|Win32 + {6B8EC880-702E-418A-BC63-CA46C6CC7B27}.Release|Win32.ActiveCfg = Release|Win32 + {6B8EC880-702E-418A-BC63-CA46C6CC7B27}.Release|Win32.Build.0 = Release|Win32 + {709A954B-4F1E-4375-A418-BCBFFE598715}.Debug|Win32.ActiveCfg = Debug|Win32 + {709A954B-4F1E-4375-A418-BCBFFE598715}.Debug|Win32.Build.0 = Debug|Win32 + {709A954B-4F1E-4375-A418-BCBFFE598715}.Release|Win32.ActiveCfg = Release|Win32 + {709A954B-4F1E-4375-A418-BCBFFE598715}.Release|Win32.Build.0 = Release|Win32 + {6376B8E4-7FD4-466B-978E-E8DA6E938689}.Debug|Win32.ActiveCfg = Debug|Win32 + {6376B8E4-7FD4-466B-978E-E8DA6E938689}.Debug|Win32.Build.0 = Debug|Win32 + {6376B8E4-7FD4-466B-978E-E8DA6E938689}.Release|Win32.ActiveCfg = Release|Win32 + {6376B8E4-7FD4-466B-978E-E8DA6E938689}.Release|Win32.Build.0 = Release|Win32 + {4FF64FA7-6806-401D-865C-79DD064D4A9E}.Debug|Win32.ActiveCfg = Debug|Win32 + {4FF64FA7-6806-401D-865C-79DD064D4A9E}.Debug|Win32.Build.0 = Debug|Win32 + {4FF64FA7-6806-401D-865C-79DD064D4A9E}.Release|Win32.ActiveCfg = Release|Win32 + {4FF64FA7-6806-401D-865C-79DD064D4A9E}.Release|Win32.Build.0 = Release|Win32 + {CD69B175-389E-4F8F-85DC-03C56A47CD1D}.Debug|Win32.ActiveCfg = Debug|Win32 + {CD69B175-389E-4F8F-85DC-03C56A47CD1D}.Debug|Win32.Build.0 = Debug|Win32 + {CD69B175-389E-4F8F-85DC-03C56A47CD1D}.Release|Win32.ActiveCfg = Release|Win32 + {CD69B175-389E-4F8F-85DC-03C56A47CD1D}.Release|Win32.Build.0 = Release|Win32 + {256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Debug|Win32.ActiveCfg = Debug|Win32 + {256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Debug|Win32.Build.0 = Debug|Win32 + {256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Release|Win32.ActiveCfg = Release|Win32 + {256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Release|Win32.Build.0 = Release|Win32 + {F9F236A2-8B57-415A-8397-7145144400F5}.Debug|Win32.ActiveCfg = Debug|Win32 + {F9F236A2-8B57-415A-8397-7145144400F5}.Debug|Win32.Build.0 = Debug|Win32 + {F9F236A2-8B57-415A-8397-7145144400F5}.Release|Win32.ActiveCfg = Release|Win32 + {F9F236A2-8B57-415A-8397-7145144400F5}.Release|Win32.Build.0 = Release|Win32 + {03FC7556-1052-45FF-A162-90D595713EAB}.Debug|Win32.ActiveCfg = Debug|Win32 + {03FC7556-1052-45FF-A162-90D595713EAB}.Release|Win32.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libs/filesystem/v3/test/msvc/filesystem_dll/filesystem_dll.vcproj b/libs/filesystem/v3/test/msvc/filesystem_dll/filesystem_dll.vcproj new file mode 100644 index 0000000000..1120bf3fd5 --- /dev/null +++ b/libs/filesystem/v3/test/msvc/filesystem_dll/filesystem_dll.vcproj @@ -0,0 +1,227 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="filesystem_dll" + ProjectGUID="{FFD738F7-96F0-445C-81EA-551665EF53D1}" + RootNamespace="filesystem_dll" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(TEMP)\$(SolutionName)\$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FILESYSTEM_DLL_EXPORTS" + MinimalRebuild="true" + ExceptionHandling="2" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(TEMP)\$(SolutionName)\$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FILESYSTEM_DLL_EXPORTS" + ExceptionHandling="2" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\..\src\codecvt_error_category.cpp" + > + </File> + <File + RelativePath="..\..\..\src\operations.cpp" + > + </File> + <File + RelativePath="..\..\..\src\path.cpp" + > + </File> + <File + RelativePath="..\..\..\src\path_traits.cpp" + > + </File> + <File + RelativePath="..\..\..\src\portability.cpp" + > + </File> + <File + RelativePath="..\..\..\src\unique_path.cpp" + > + </File> + <File + RelativePath="..\..\..\src\utf8_codecvt_facet.cpp" + > + </File> + <File + RelativePath="..\..\..\src\windows_file_codecvt.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/fstream_test/fstream_test.vcproj b/libs/filesystem/v3/test/msvc/fstream_test/fstream_test.vcproj new file mode 100644 index 0000000000..6eb91af5ad --- /dev/null +++ b/libs/filesystem/v3/test/msvc/fstream_test/fstream_test.vcproj @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="fstream_test" + ProjectGUID="{A9939CD7-BE1C-4334-947C-4C320D49B3CA}" + RootNamespace="fstream_test" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\fstream_test.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/operations_test/operations_test.vcproj b/libs/filesystem/v3/test/msvc/operations_test/operations_test.vcproj new file mode 100644 index 0000000000..5e0cac2c72 --- /dev/null +++ b/libs/filesystem/v3/test/msvc/operations_test/operations_test.vcproj @@ -0,0 +1,194 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="operations_test" + ProjectGUID="{8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}" + RootNamespace="operations_test" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="BOOST_FILEYSTEM_INCLUDE_IOSTREAM" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe" -x" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe" -x" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\operations_test.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/operations_unit_test/operations_unit_test.vcproj b/libs/filesystem/v3/test/msvc/operations_unit_test/operations_unit_test.vcproj new file mode 100644 index 0000000000..a5f95ed74a --- /dev/null +++ b/libs/filesystem/v3/test/msvc/operations_unit_test/operations_unit_test.vcproj @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="operations_unit_test" + ProjectGUID="{5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}" + RootNamespace="operations_unit_test" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\operations_unit_test.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/path_test/path_test.vcproj b/libs/filesystem/v3/test/msvc/path_test/path_test.vcproj new file mode 100644 index 0000000000..1131adfa5d --- /dev/null +++ b/libs/filesystem/v3/test/msvc/path_test/path_test.vcproj @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="path_test" + ProjectGUID="{F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}" + RootNamespace="path_test" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="BOOST_FILESYSTEM_PATH_CTOR_COUNT;WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\path_test.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/path_test_dynamic_link/path_test_dynamic_linkl.vcproj b/libs/filesystem/v3/test/msvc/path_test_dynamic_link/path_test_dynamic_linkl.vcproj new file mode 100644 index 0000000000..9a754ef7c9 --- /dev/null +++ b/libs/filesystem/v3/test/msvc/path_test_dynamic_link/path_test_dynamic_linkl.vcproj @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="path_test_dynamic_link" + ProjectGUID="{54347DE3-6AA2-4466-A2EC-7176E0EC1110}" + RootNamespace="path_test_dynamic_link" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(TEMP)\$(SolutionName)\$(ConfigurationName)" + IntermediateDirectory="$(TEMP)\$(SolutionName)\$(ProjectName)\$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\..\..\..\.." + PreprocessorDefinitions="BOOST_ALL_NO_LIB;BOOST_SYSTEM_DYN_LINK;BOOST_FILESYSTEM_DYN_LINK;WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + ExceptionHandling="2" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(TEMP)\$(SolutionName)\$(ConfigurationName)" + IntermediateDirectory="$(TEMP)\$(SolutionName)\$(ProjectName)\$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="..\..\..\..\.." + PreprocessorDefinitions="BOOST_ALL_NO_LIB;BOOST_SYSTEM_DYN_LINK;BOOST_FILESYSTEM_DYN_LINK;WIN32;NDEBUG;_CONSOLE" + ExceptionHandling="2" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\path_test.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/path_unit_test/path_unit_test.vcproj b/libs/filesystem/v3/test/msvc/path_unit_test/path_unit_test.vcproj new file mode 100644 index 0000000000..0f39d3bc59 --- /dev/null +++ b/libs/filesystem/v3/test/msvc/path_unit_test/path_unit_test.vcproj @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="path_unit_test" + ProjectGUID="{3C77F610-2E31-4087-9DF2-7CD45198A02D}" + RootNamespace="path_unit_test" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\path_unit_test.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/simple_ls/simple_ls.vcproj b/libs/filesystem/v3/test/msvc/simple_ls/simple_ls.vcproj new file mode 100644 index 0000000000..3d52d4becd --- /dev/null +++ b/libs/filesystem/v3/test/msvc/simple_ls/simple_ls.vcproj @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="simple_ls" + ProjectGUID="{6B8EC880-702E-418A-BC63-CA46C6CC7B27}" + RootNamespace="simple_ls" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(TEMP)\$(SolutionName)\$(ConfigurationName)" + IntermediateDirectory="$(TEMP)\$(SolutionName)\$(ProjectName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\..\..\..\.." + PreprocessorDefinitions="BOOST_ALL_NO_LIB;BOOST_SYSTEM_DYN_LINK;BOOST_FILESYSTEM_DYN_LINK;WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(TEMP)\$(SolutionName)\$(ConfigurationName)" + IntermediateDirectory="$(TEMP)\$(SolutionName)\$(ProjectName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="..\..\..\..\.." + PreprocessorDefinitions="BOOST_ALL_NO_LIB;BOOST_SYSTEM_DYN_LINK;BOOST_FILESYSTEM_DYN_LINK;WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\..\example\simple_ls.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/system_dll/system_dll.vcproj b/libs/filesystem/v3/test/msvc/system_dll/system_dll.vcproj new file mode 100644 index 0000000000..792371fd34 --- /dev/null +++ b/libs/filesystem/v3/test/msvc/system_dll/system_dll.vcproj @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="system_dll" + ProjectGUID="{F94CCADD-A90B-480C-A304-C19D015D36B1}" + RootNamespace="system_dll" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(TEMP)\$(SolutionName)\$(ConfigurationName)" + IntermediateDirectory="$(TEMP)\$(SolutionName)\$(ProjectName)\$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;WIN32;_DEBUG;_WINDOWS;_USRDLL;SYSTEM_DLL_EXPORTS" + MinimalRebuild="true" + ExceptionHandling="2" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(TEMP)\$(SolutionName)\$(ConfigurationName)" + IntermediateDirectory="$(TEMP)\$(SolutionName)\$(ProjectName)\$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;WIN32;NDEBUG;_WINDOWS;_USRDLL;SYSTEM_DLL_EXPORTS" + ExceptionHandling="2" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\..\..\..\system\src\error_code.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/tchar_example/tchar_example.vcproj b/libs/filesystem/v3/test/msvc/tchar_example/tchar_example.vcproj new file mode 100644 index 0000000000..80548e2e8c --- /dev/null +++ b/libs/filesystem/v3/test/msvc/tchar_example/tchar_example.vcproj @@ -0,0 +1,212 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="tchar_example" + ProjectGUID="{2D4CD761-6DF6-40AC-B4A5-F169D5F93226}" + RootNamespace="tchar_example" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(TEMP)\$(SolutionName)\$(ConfigurationName)" + IntermediateDirectory="$(TEMP)\$(SolutionName)\$(ProjectName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(TEMP)\$(SolutionName)\$(ConfigurationName)" + IntermediateDirectory="$(TEMP)\$(SolutionName)\$(ProjectName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Executing test $(TargetName).exe..." + CommandLine=""$(TargetDir)\$(TargetName).exe"" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\..\..\system\src\error_code.cpp" + > + </File> + <File + RelativePath="..\..\..\src\operations.cpp" + > + </File> + <File + RelativePath="..\..\..\src\path.cpp" + > + </File> + <File + RelativePath="..\..\..\example\tchar.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/tut0/tut0.vcproj b/libs/filesystem/v3/test/msvc/tut0/tut0.vcproj new file mode 100644 index 0000000000..fea6600ba4 --- /dev/null +++ b/libs/filesystem/v3/test/msvc/tut0/tut0.vcproj @@ -0,0 +1,190 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="tut0" + ProjectGUID="{6B5ABD07-0289-484D-BD96-6F1BC92677D3}" + RootNamespace="tut0" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\..\example\tut0.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/tut1/tut1.vcproj b/libs/filesystem/v3/test/msvc/tut1/tut1.vcproj new file mode 100644 index 0000000000..d288e52720 --- /dev/null +++ b/libs/filesystem/v3/test/msvc/tut1/tut1.vcproj @@ -0,0 +1,193 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="tut1" + ProjectGUID="{6376B8E4-7FD4-466B-978E-E8DA6E938689}" + RootNamespace="tut1" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\..\example\tut1.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/tut2/tut2.vcproj b/libs/filesystem/v3/test/msvc/tut2/tut2.vcproj new file mode 100644 index 0000000000..47d157d8d7 --- /dev/null +++ b/libs/filesystem/v3/test/msvc/tut2/tut2.vcproj @@ -0,0 +1,189 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="tut2" + ProjectGUID="{CD69B175-389E-4F8F-85DC-03C56A47CD1D}" + RootNamespace="tut2" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\..\example\tut2.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/tut3/tut3.vcproj b/libs/filesystem/v3/test/msvc/tut3/tut3.vcproj new file mode 100644 index 0000000000..37964b0efb --- /dev/null +++ b/libs/filesystem/v3/test/msvc/tut3/tut3.vcproj @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="tut3" + ProjectGUID="{4FF64FA7-6806-401D-865C-79DD064D4A9E}" + RootNamespace="tut3" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\..\example\tut3.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/tut4/tut4.vcproj b/libs/filesystem/v3/test/msvc/tut4/tut4.vcproj new file mode 100644 index 0000000000..307b9b7cc0 --- /dev/null +++ b/libs/filesystem/v3/test/msvc/tut4/tut4.vcproj @@ -0,0 +1,189 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="tut4" + ProjectGUID="{256EA89A-E073-4CE8-B675-BE2FBC6B2691}" + RootNamespace="tut4" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\..\example\tut4.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc/wide_test/wide_test.vcproj b/libs/filesystem/v3/test/msvc/wide_test/wide_test.vcproj new file mode 100644 index 0000000000..d16960254e --- /dev/null +++ b/libs/filesystem/v3/test/msvc/wide_test/wide_test.vcproj @@ -0,0 +1,191 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="wide_test" + ProjectGUID="{DE12E87D-87C1-4FF3-AF16-85097F2A5184}" + RootNamespace="wide_test" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="..\common.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\wide_test.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/filesystem/v3/test/msvc10/common.props b/libs/filesystem/v3/test/msvc10/common.props new file mode 100644 index 0000000000..a341a589c5 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/common.props @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir>$(TEMP)\$(SolutionName)\$(Configuration)\</OutDir> + <IntDir>$(TEMP)\$(SolutionName)\$(ProjectName)\$(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>../../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>BOOST_FILESYSTEM_VERSION=3;BOOST_SYSTEM_NO_DEPRECATED;BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>Async</ExceptionHandling> + <DisableLanguageExtensions>false</DisableLanguageExtensions> + <WarningLevel>Level4</WarningLevel> + </ClCompile> + <Link> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/convenience_test/convenience_test.vcxproj b/libs/filesystem/v3/test/msvc10/convenience_test/convenience_test.vcxproj new file mode 100644 index 0000000000..437ebf6b90 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/convenience_test/convenience_test.vcxproj @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{08986FB5-0C83-4BC4-92DF-05E12E1C03C1}</ProjectGuid> + <RootNamespace>convenience_test</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\convenience_test.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/deprecated_test/deprecated_test.vcxproj b/libs/filesystem/v3/test/msvc10/deprecated_test/deprecated_test.vcxproj new file mode 100644 index 0000000000..c16b17707a --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/deprecated_test/deprecated_test.vcxproj @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{D73BC50F-956E-4A44-BF9F-A8BB80DF0000}</ProjectGuid> + <RootNamespace>deprecated_test</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_SYSTEM_DYN_LINK;BOOST_FILESYSTEM_DYN_LINK;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_SYSTEM_DYN_LINK;BOOST_FILESYSTEM_DYN_LINK;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\deprecated_test.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/file_status/file_status.vcxproj b/libs/filesystem/v3/test/msvc10/file_status/file_status.vcxproj new file mode 100644 index 0000000000..dc8adc23dd --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/file_status/file_status.vcxproj @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>file_status</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + <PostBuildEvent> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + <Message>Executing test $(TargetName).exe...</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <PostBuildEvent> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + <Message>Executing test $(TargetName).exe...</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\example\file_status.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/filesystem-v3.sln b/libs/filesystem/v3/test/msvc10/filesystem-v3.sln new file mode 100644 index 0000000000..7f92726173 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/filesystem-v3.sln @@ -0,0 +1,190 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "path_unit_test", "path_unit_test\path_unit_test.vcxproj", "{3C77F610-2E31-4087-9DF2-7CD45198A02D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "operations_unit_test", "operations_unit_test\operations_unit_test.vcxproj", "{5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "operations_test", "operations_test\operations_test.vcxproj", "{8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "path_test", "path_test\path_test.vcxproj", "{F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "system_dll", "system_dll\system_dll.vcxproj", "{F94CCADD-A90B-480C-A304-C19D015D36B1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filesystem_dll", "filesystem_dll\filesystem_dll.vcxproj", "{FFD738F7-96F0-445C-81EA-551665EF53D1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convenience_test", "convenience_test\convenience_test.vcxproj", "{08986FB5-0C83-4BC4-92DF-05E12E1C03C1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fstream_test", "fstream_test\fstream_test.vcxproj", "{A9939CD7-BE1C-4334-947C-4C320D49B3CA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "deprecated_test", "deprecated_test\deprecated_test.vcxproj", "{D73BC50F-956E-4A44-BF9F-A8BB80DF0000}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut1", "tut1\tut1.vcxproj", "{6376B8E4-7FD4-466B-978E-E8DA6E938689}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut3", "tut3\tut3.vcxproj", "{4FF64FA7-6806-401D-865C-79DD064D4A9E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut2", "tut2\tut2.vcxproj", "{CD69B175-389E-4F8F-85DC-03C56A47CD1D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut4", "tut4\tut4.vcxproj", "{256EA89A-E073-4CE8-B675-BE2FBC6B2691}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "windows_attributes", "windows_attributes\windows_attributes.vcxproj", "{FC5C770F-3017-4021-8DAF-C5DCA3FDF005}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut5", "tut5\tut5.vcxproj", "{5C9B3380-3C6E-45CC-986A-16D245E27E58}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut6a", "tut6a\tut6a.vcxproj", "{C781F9C4-31D4-4509-B031-84DB598B207D}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut6b", "tut6b\tut6b.vcxproj", "{4A77CA6A-8E72-4CC6-9FE7-2C555C51815C}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut6c", "tut6c\tut6c.vcxproj", "{17C6DD1B-EF6F-4561-B4FF-CF39F975ED29}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stems", "stems\stems.vcxproj", "{23C735E1-0195-467F-BE9F-314829402FCF}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "long_path_test", "long_path_test\long_path_test.vcxproj", "{1A6A7DAF-8705-4B2B-83B5-93F84A63496C}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "file_status", "file_status\file_status.vcxproj", "{43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "locale_info", "locale_info\locale_info.vcxproj", "{3667C35E-78D5-43D4-AAC2-349145E4341D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thread_test", "thread_test\thread_test.vcxproj", "{20E2805D-9634-46CE-B979-21CCBBD16EA3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symlinked_cpp", "symlinked_cpp\symlinked_cpp.vcxproj", "{E37919AE-1A38-4E61-8E5E-FE4F981C6BFD}" + ProjectSection(ProjectDependencies) = postProject + {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1} + {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3C77F610-2E31-4087-9DF2-7CD45198A02D}.Debug|Win32.ActiveCfg = Debug|Win32 + {3C77F610-2E31-4087-9DF2-7CD45198A02D}.Debug|Win32.Build.0 = Debug|Win32 + {3C77F610-2E31-4087-9DF2-7CD45198A02D}.Release|Win32.ActiveCfg = Release|Win32 + {3C77F610-2E31-4087-9DF2-7CD45198A02D}.Release|Win32.Build.0 = Release|Win32 + {5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}.Debug|Win32.ActiveCfg = Debug|Win32 + {5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}.Debug|Win32.Build.0 = Debug|Win32 + {5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}.Release|Win32.ActiveCfg = Release|Win32 + {5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}.Release|Win32.Build.0 = Release|Win32 + {8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}.Debug|Win32.ActiveCfg = Debug|Win32 + {8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}.Debug|Win32.Build.0 = Debug|Win32 + {8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}.Release|Win32.ActiveCfg = Release|Win32 + {8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}.Release|Win32.Build.0 = Release|Win32 + {F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}.Debug|Win32.ActiveCfg = Debug|Win32 + {F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}.Debug|Win32.Build.0 = Debug|Win32 + {F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}.Release|Win32.ActiveCfg = Release|Win32 + {F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}.Release|Win32.Build.0 = Release|Win32 + {F94CCADD-A90B-480C-A304-C19D015D36B1}.Debug|Win32.ActiveCfg = Debug|Win32 + {F94CCADD-A90B-480C-A304-C19D015D36B1}.Debug|Win32.Build.0 = Debug|Win32 + {F94CCADD-A90B-480C-A304-C19D015D36B1}.Release|Win32.ActiveCfg = Release|Win32 + {F94CCADD-A90B-480C-A304-C19D015D36B1}.Release|Win32.Build.0 = Release|Win32 + {FFD738F7-96F0-445C-81EA-551665EF53D1}.Debug|Win32.ActiveCfg = Debug|Win32 + {FFD738F7-96F0-445C-81EA-551665EF53D1}.Debug|Win32.Build.0 = Debug|Win32 + {FFD738F7-96F0-445C-81EA-551665EF53D1}.Release|Win32.ActiveCfg = Release|Win32 + {FFD738F7-96F0-445C-81EA-551665EF53D1}.Release|Win32.Build.0 = Release|Win32 + {08986FB5-0C83-4BC4-92DF-05E12E1C03C1}.Debug|Win32.ActiveCfg = Debug|Win32 + {08986FB5-0C83-4BC4-92DF-05E12E1C03C1}.Debug|Win32.Build.0 = Debug|Win32 + {08986FB5-0C83-4BC4-92DF-05E12E1C03C1}.Release|Win32.ActiveCfg = Release|Win32 + {08986FB5-0C83-4BC4-92DF-05E12E1C03C1}.Release|Win32.Build.0 = Release|Win32 + {A9939CD7-BE1C-4334-947C-4C320D49B3CA}.Debug|Win32.ActiveCfg = Debug|Win32 + {A9939CD7-BE1C-4334-947C-4C320D49B3CA}.Debug|Win32.Build.0 = Debug|Win32 + {A9939CD7-BE1C-4334-947C-4C320D49B3CA}.Release|Win32.ActiveCfg = Release|Win32 + {A9939CD7-BE1C-4334-947C-4C320D49B3CA}.Release|Win32.Build.0 = Release|Win32 + {D73BC50F-956E-4A44-BF9F-A8BB80DF0000}.Debug|Win32.ActiveCfg = Debug|Win32 + {D73BC50F-956E-4A44-BF9F-A8BB80DF0000}.Debug|Win32.Build.0 = Debug|Win32 + {D73BC50F-956E-4A44-BF9F-A8BB80DF0000}.Release|Win32.ActiveCfg = Release|Win32 + {D73BC50F-956E-4A44-BF9F-A8BB80DF0000}.Release|Win32.Build.0 = Release|Win32 + {6376B8E4-7FD4-466B-978E-E8DA6E938689}.Debug|Win32.ActiveCfg = Debug|Win32 + {6376B8E4-7FD4-466B-978E-E8DA6E938689}.Debug|Win32.Build.0 = Debug|Win32 + {6376B8E4-7FD4-466B-978E-E8DA6E938689}.Release|Win32.ActiveCfg = Release|Win32 + {6376B8E4-7FD4-466B-978E-E8DA6E938689}.Release|Win32.Build.0 = Release|Win32 + {4FF64FA7-6806-401D-865C-79DD064D4A9E}.Debug|Win32.ActiveCfg = Debug|Win32 + {4FF64FA7-6806-401D-865C-79DD064D4A9E}.Debug|Win32.Build.0 = Debug|Win32 + {4FF64FA7-6806-401D-865C-79DD064D4A9E}.Release|Win32.ActiveCfg = Release|Win32 + {4FF64FA7-6806-401D-865C-79DD064D4A9E}.Release|Win32.Build.0 = Release|Win32 + {CD69B175-389E-4F8F-85DC-03C56A47CD1D}.Debug|Win32.ActiveCfg = Debug|Win32 + {CD69B175-389E-4F8F-85DC-03C56A47CD1D}.Debug|Win32.Build.0 = Debug|Win32 + {CD69B175-389E-4F8F-85DC-03C56A47CD1D}.Release|Win32.ActiveCfg = Release|Win32 + {CD69B175-389E-4F8F-85DC-03C56A47CD1D}.Release|Win32.Build.0 = Release|Win32 + {256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Debug|Win32.ActiveCfg = Debug|Win32 + {256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Debug|Win32.Build.0 = Debug|Win32 + {256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Release|Win32.ActiveCfg = Release|Win32 + {256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Release|Win32.Build.0 = Release|Win32 + {FC5C770F-3017-4021-8DAF-C5DCA3FDF005}.Debug|Win32.ActiveCfg = Debug|Win32 + {FC5C770F-3017-4021-8DAF-C5DCA3FDF005}.Debug|Win32.Build.0 = Debug|Win32 + {FC5C770F-3017-4021-8DAF-C5DCA3FDF005}.Release|Win32.ActiveCfg = Release|Win32 + {FC5C770F-3017-4021-8DAF-C5DCA3FDF005}.Release|Win32.Build.0 = Release|Win32 + {5C9B3380-3C6E-45CC-986A-16D245E27E58}.Debug|Win32.ActiveCfg = Debug|Win32 + {5C9B3380-3C6E-45CC-986A-16D245E27E58}.Debug|Win32.Build.0 = Debug|Win32 + {5C9B3380-3C6E-45CC-986A-16D245E27E58}.Release|Win32.ActiveCfg = Release|Win32 + {5C9B3380-3C6E-45CC-986A-16D245E27E58}.Release|Win32.Build.0 = Release|Win32 + {C781F9C4-31D4-4509-B031-84DB598B207D}.Debug|Win32.ActiveCfg = Debug|Win32 + {C781F9C4-31D4-4509-B031-84DB598B207D}.Debug|Win32.Build.0 = Debug|Win32 + {C781F9C4-31D4-4509-B031-84DB598B207D}.Release|Win32.ActiveCfg = Release|Win32 + {C781F9C4-31D4-4509-B031-84DB598B207D}.Release|Win32.Build.0 = Release|Win32 + {4A77CA6A-8E72-4CC6-9FE7-2C555C51815C}.Debug|Win32.ActiveCfg = Debug|Win32 + {4A77CA6A-8E72-4CC6-9FE7-2C555C51815C}.Debug|Win32.Build.0 = Debug|Win32 + {4A77CA6A-8E72-4CC6-9FE7-2C555C51815C}.Release|Win32.ActiveCfg = Release|Win32 + {4A77CA6A-8E72-4CC6-9FE7-2C555C51815C}.Release|Win32.Build.0 = Release|Win32 + {17C6DD1B-EF6F-4561-B4FF-CF39F975ED29}.Debug|Win32.ActiveCfg = Debug|Win32 + {17C6DD1B-EF6F-4561-B4FF-CF39F975ED29}.Debug|Win32.Build.0 = Debug|Win32 + {17C6DD1B-EF6F-4561-B4FF-CF39F975ED29}.Release|Win32.ActiveCfg = Release|Win32 + {17C6DD1B-EF6F-4561-B4FF-CF39F975ED29}.Release|Win32.Build.0 = Release|Win32 + {23C735E1-0195-467F-BE9F-314829402FCF}.Debug|Win32.ActiveCfg = Debug|Win32 + {23C735E1-0195-467F-BE9F-314829402FCF}.Debug|Win32.Build.0 = Debug|Win32 + {23C735E1-0195-467F-BE9F-314829402FCF}.Release|Win32.ActiveCfg = Release|Win32 + {23C735E1-0195-467F-BE9F-314829402FCF}.Release|Win32.Build.0 = Release|Win32 + {1A6A7DAF-8705-4B2B-83B5-93F84A63496C}.Debug|Win32.ActiveCfg = Debug|Win32 + {1A6A7DAF-8705-4B2B-83B5-93F84A63496C}.Debug|Win32.Build.0 = Debug|Win32 + {1A6A7DAF-8705-4B2B-83B5-93F84A63496C}.Release|Win32.ActiveCfg = Release|Win32 + {1A6A7DAF-8705-4B2B-83B5-93F84A63496C}.Release|Win32.Build.0 = Release|Win32 + {43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}.Debug|Win32.ActiveCfg = Debug|Win32 + {43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}.Debug|Win32.Build.0 = Debug|Win32 + {43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}.Release|Win32.ActiveCfg = Release|Win32 + {43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}.Release|Win32.Build.0 = Release|Win32 + {3667C35E-78D5-43D4-AAC2-349145E4341D}.Debug|Win32.ActiveCfg = Debug|Win32 + {3667C35E-78D5-43D4-AAC2-349145E4341D}.Debug|Win32.Build.0 = Debug|Win32 + {3667C35E-78D5-43D4-AAC2-349145E4341D}.Release|Win32.ActiveCfg = Release|Win32 + {3667C35E-78D5-43D4-AAC2-349145E4341D}.Release|Win32.Build.0 = Release|Win32 + {20E2805D-9634-46CE-B979-21CCBBD16EA3}.Debug|Win32.ActiveCfg = Debug|Win32 + {20E2805D-9634-46CE-B979-21CCBBD16EA3}.Debug|Win32.Build.0 = Debug|Win32 + {20E2805D-9634-46CE-B979-21CCBBD16EA3}.Release|Win32.ActiveCfg = Release|Win32 + {20E2805D-9634-46CE-B979-21CCBBD16EA3}.Release|Win32.Build.0 = Release|Win32 + {E37919AE-1A38-4E61-8E5E-FE4F981C6BFD}.Debug|Win32.ActiveCfg = Debug|Win32 + {E37919AE-1A38-4E61-8E5E-FE4F981C6BFD}.Debug|Win32.Build.0 = Debug|Win32 + {E37919AE-1A38-4E61-8E5E-FE4F981C6BFD}.Release|Win32.ActiveCfg = Release|Win32 + {E37919AE-1A38-4E61-8E5E-FE4F981C6BFD}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libs/filesystem/v3/test/msvc10/filesystem_dll/filesystem_dll.vcxproj b/libs/filesystem/v3/test/msvc10/filesystem_dll/filesystem_dll.vcxproj new file mode 100644 index 0000000000..64d97fc53b --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/filesystem_dll/filesystem_dll.vcxproj @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{FFD738F7-96F0-445C-81EA-551665EF53D1}</ProjectGuid> + <RootNamespace>filesystem_dll</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(TEMP)\$(SolutionName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(TEMP)\$(SolutionName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FILESYSTEM_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <ExceptionHandling>Async</ExceptionHandling> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FILESYSTEM_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>Async</ExceptionHandling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\src\codecvt_error_category.cpp" /> + <ClCompile Include="..\..\..\src\operations.cpp" /> + <ClCompile Include="..\..\..\src\path.cpp" /> + <ClCompile Include="..\..\..\src\path_traits.cpp" /> + <ClCompile Include="..\..\..\src\portability.cpp" /> + <ClCompile Include="..\..\..\src\unique_path.cpp" /> + <ClCompile Include="..\..\..\src\utf8_codecvt_facet.cpp" /> + <ClCompile Include="..\..\..\src\windows_file_codecvt.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/fstream_test/fstream_test.vcxproj b/libs/filesystem/v3/test/msvc10/fstream_test/fstream_test.vcxproj new file mode 100644 index 0000000000..90ed1fb262 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/fstream_test/fstream_test.vcxproj @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{A9939CD7-BE1C-4334-947C-4C320D49B3CA}</ProjectGuid> + <RootNamespace>fstream_test</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\fstream_test.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/locale_info/locale_info.vcxproj b/libs/filesystem/v3/test/msvc10/locale_info/locale_info.vcxproj new file mode 100644 index 0000000000..e2ce0eb6bc --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/locale_info/locale_info.vcxproj @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{3667C35E-78D5-43D4-AAC2-349145E4341D}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>locale_info</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + <PostBuildEvent> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <PostBuildEvent> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\locale_info.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/long_path_test/long_path_test.vcxproj b/libs/filesystem/v3/test/msvc10/long_path_test/long_path_test.vcxproj new file mode 100644 index 0000000000..c8cc1910bb --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/long_path_test/long_path_test.vcxproj @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{1A6A7DAF-8705-4B2B-83B5-93F84A63496C}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>long_path_test</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + <PostBuildEvent> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + <Message>Executing test $(TargetName).exe...</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <PostBuildEvent> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + <Message>Executing test $(TargetName).exe...</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\long_path_test.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/operations_test/operations_test.vcxproj b/libs/filesystem/v3/test/msvc10/operations_test/operations_test.vcxproj new file mode 100644 index 0000000000..b7bd47aea7 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/operations_test/operations_test.vcxproj @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{8BB7E604-46EF-42BE-ABB5-D7044B3E8A40}</ProjectGuid> + <RootNamespace>operations_test</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>BOOST_FILEYSTEM_INCLUDE_IOSTREAM;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe" -x</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe" -x</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\operations_test.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/operations_unit_test/operations_unit_test.vcxproj b/libs/filesystem/v3/test/msvc10/operations_unit_test/operations_unit_test.vcxproj new file mode 100644 index 0000000000..2bc35c34d0 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/operations_unit_test/operations_unit_test.vcxproj @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{5DAF595A-4640-4F86-8A5F-E54E3E4CE7D0}</ProjectGuid> + <RootNamespace>operations_unit_test</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\operations_unit_test.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/path_test/path_test.vcxproj b/libs/filesystem/v3/test/msvc10/path_test/path_test.vcxproj new file mode 100644 index 0000000000..9f2698402e --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/path_test/path_test.vcxproj @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{F3D230C4-9185-4C2B-AB0E-0F0D28D8268C}</ProjectGuid> + <RootNamespace>path_test</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>BOOST_FILESYSTEM_PATH_CTOR_COUNT;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\path_test.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/path_unit_test/path_unit_test.vcxproj b/libs/filesystem/v3/test/msvc10/path_unit_test/path_unit_test.vcxproj new file mode 100644 index 0000000000..c1203bbd85 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/path_unit_test/path_unit_test.vcxproj @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{3C77F610-2E31-4087-9DF2-7CD45198A02D}</ProjectGuid> + <RootNamespace>path_unit_test</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Message>Executing test $(TargetName).exe...</Message> + <Command>"$(TargetDir)\$(TargetName).exe"</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\path_unit_test.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/stems/stems.vcxproj b/libs/filesystem/v3/test/msvc10/stems/stems.vcxproj new file mode 100644 index 0000000000..6ed20eebdd --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/stems/stems.vcxproj @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{23C735E1-0195-467F-BE9F-314829402FCF}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>stems</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\example\stems.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/system_dll/system_dll.vcxproj b/libs/filesystem/v3/test/msvc10/system_dll/system_dll.vcxproj new file mode 100644 index 0000000000..dd8a490207 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/system_dll/system_dll.vcxproj @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{F94CCADD-A90B-480C-A304-C19D015D36B1}</ProjectGuid> + <RootNamespace>system_dll</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(TEMP)\$(SolutionName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(TEMP)\$(SolutionName)\$(ProjectName)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(TEMP)\$(SolutionName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(TEMP)\$(SolutionName)\$(ProjectName)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;WIN32;_DEBUG;_WINDOWS;_USRDLL;SYSTEM_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <ExceptionHandling>Async</ExceptionHandling> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;WIN32;NDEBUG;_WINDOWS;_USRDLL;SYSTEM_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>Async</ExceptionHandling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\..\..\system\src\error_code.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/tut1/tut1.vcxproj b/libs/filesystem/v3/test/msvc10/tut1/tut1.vcxproj new file mode 100644 index 0000000000..4c2db0a437 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/tut1/tut1.vcxproj @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{6376B8E4-7FD4-466B-978E-E8DA6E938689}</ProjectGuid> + <RootNamespace>tut1</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\example\tut1.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/tut2/tut2.vcxproj b/libs/filesystem/v3/test/msvc10/tut2/tut2.vcxproj new file mode 100644 index 0000000000..4e550c9e0c --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/tut2/tut2.vcxproj @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{CD69B175-389E-4F8F-85DC-03C56A47CD1D}</ProjectGuid> + <RootNamespace>tut2</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\example\tut2.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/tut3/tut3.vcxproj b/libs/filesystem/v3/test/msvc10/tut3/tut3.vcxproj new file mode 100644 index 0000000000..ddce9f8ca9 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/tut3/tut3.vcxproj @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{4FF64FA7-6806-401D-865C-79DD064D4A9E}</ProjectGuid> + <RootNamespace>tut3</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\example\tut3.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/tut4/tut4.vcxproj b/libs/filesystem/v3/test/msvc10/tut4/tut4.vcxproj new file mode 100644 index 0000000000..9f838c2877 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/tut4/tut4.vcxproj @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{256EA89A-E073-4CE8-B675-BE2FBC6B2691}</ProjectGuid> + <RootNamespace>tut4</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\example\tut4.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/tut5/tut5.vcxproj b/libs/filesystem/v3/test/msvc10/tut5/tut5.vcxproj new file mode 100644 index 0000000000..bab4052952 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/tut5/tut5.vcxproj @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{5C9B3380-3C6E-45CC-986A-16D245E27E58}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>tut5</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\example\tut5.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/tut6a/tut6a.vcxproj b/libs/filesystem/v3/test/msvc10/tut6a/tut6a.vcxproj new file mode 100644 index 0000000000..2794be5dbf --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/tut6a/tut6a.vcxproj @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C781F9C4-31D4-4509-B031-84DB598B207D}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>tut6a</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\example\tut6a.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/tut6b/tut6b.vcxproj b/libs/filesystem/v3/test/msvc10/tut6b/tut6b.vcxproj new file mode 100644 index 0000000000..b2be1370a9 --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/tut6b/tut6b.vcxproj @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{4A77CA6A-8E72-4CC6-9FE7-2C555C51815C}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>tut6b</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\example\tut6b.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/tut6c/tut6c.vcxproj b/libs/filesystem/v3/test/msvc10/tut6c/tut6c.vcxproj new file mode 100644 index 0000000000..e06f948fbb --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/tut6c/tut6c.vcxproj @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{17C6DD1B-EF6F-4561-B4FF-CF39F975ED29}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>tut6c</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\example\tut6c.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/msvc10/windows_attributes/windows_attributes.vcxproj b/libs/filesystem/v3/test/msvc10/windows_attributes/windows_attributes.vcxproj new file mode 100644 index 0000000000..cd0e68e88a --- /dev/null +++ b/libs/filesystem/v3/test/msvc10/windows_attributes/windows_attributes.vcxproj @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{FC5C770F-3017-4021-8DAF-C5DCA3FDF005}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>windows_attributes</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\common.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\windows_attributes.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj"> + <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project> + </ProjectReference> + <ProjectReference Include="..\system_dll\system_dll.vcxproj"> + <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/libs/filesystem/v3/test/operations_test.cpp b/libs/filesystem/v3/test/operations_test.cpp new file mode 100644 index 0000000000..610f27fca1 --- /dev/null +++ b/libs/filesystem/v3/test/operations_test.cpp @@ -0,0 +1,2005 @@ +// Boost operations_test.cpp ---------------------------------------------------------// + +// Copyright Beman Dawes 2002, 2009. + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#define BOOST_FILESYSTEM_VERSION 3 + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/config/warning_disable.hpp> + +// See deprecated_test for tests of deprecated features +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +# define BOOST_FILESYSTEM_NO_DEPRECATED +#endif +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/operations.hpp> +#include <boost/cerrno.hpp> +namespace fs = boost::filesystem; + +#include <boost/detail/lightweight_test.hpp> +#include <boost/detail/lightweight_main.hpp> + +using boost::system::error_code; +using boost::system::system_category; +using boost::system::system_error; + +#include <fstream> +#include <iostream> + +using std::cout; +using std::endl; + +#include <string> +#include <vector> +#include <algorithm> +#include <cstring> // for strncmp, etc. +#include <ctime> +#include <cstdlib> // for system(), getenv(), etc. + +#ifdef BOOST_WINDOWS_API +# include <windows.h> + +inline std::wstring convert(const char* c) +{ + std::string s(c); + + return std::wstring(s.begin(), s.end()); +} + +inline int setenv(const char* name, const fs::path::value_type* val, int) +{ + return SetEnvironmentVariableW(convert(name).c_str(), val); +} + +inline int setenv(const char* name, const char* val, int) +{ + return SetEnvironmentVariableW(convert(name).c_str(), convert(val).c_str()); +} + +inline int unsetenv(const char* name) +{ + return SetEnvironmentVariableW(convert(name).c_str(), 0); +} + +#else + +#include <stdlib.h> // allow unqualifed calls to env funcs on SunOS + +#endif + +// on Windows, except for standard libaries known to have wchar_t overloads for +// file stream I/O, use path::string() to get a narrow character c_str() +#if defined(BOOST_WINDOWS_API) \ + && (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405) // not Dinkumware || no wide overloads +# define BOOST_FILESYSTEM_C_STR string().c_str() // use narrow, since wide not available +#else // use the native c_str, which will be narrow on POSIX, wide on Windows +# define BOOST_FILESYSTEM_C_STR c_str() +#endif + +#define CHECK_EXCEPTION(Functor,Expect) throws_fs_error(Functor,Expect,__LINE__) + +namespace +{ + typedef int errno_t; + std::string platform(BOOST_PLATFORM); + bool report_throws = false; + bool cleanup = true; + bool skip_long_windows_tests = false; + + fs::directory_iterator end_itr; + fs::path dir; + fs::path d1; + fs::path d2; + fs::path f0; + fs::path f1; + fs::path d1f1; + + bool create_symlink_ok(true); + + fs::path ng(" no-way, Jose"); + + unsigned short language_id; // 0 except for Windows + + const char* temp_dir_name = "v3_operations_test"; + + void create_file(const fs::path & ph, const std::string & contents = std::string()) + { + std::ofstream f(ph.BOOST_FILESYSTEM_C_STR); + if (!f) + throw fs::filesystem_error("operations_test create_file", + ph, error_code(errno, system_category())); + if (!contents.empty()) f << contents; + } + + void verify_file(const fs::path & ph, const std::string & expected) + { + std::ifstream f(ph.BOOST_FILESYSTEM_C_STR); + if (!f) + throw fs::filesystem_error("operations_test verify_file", + ph, error_code(errno, system_category())); + std::string contents; + f >> contents; + if (contents != expected) + throw fs::filesystem_error("operations_test verify_file contents \"" + + contents + "\" != \"" + expected + "\"", ph, error_code()); + } + + template< typename F > + bool throws_fs_error(F func, errno_t en, int line) + { + try { func(); } + + catch (const fs::filesystem_error & ex) + { + if (report_throws) + { + // use the what() convenience function to display exceptions + cout << "\n" << ex.what() << "\n"; + } + if (en == 0 + || en == ex.code().default_error_condition().value()) return true; + cout + << "\nWarning: line " << line + << " exception reports default_error_condition().value() " + << ex.code().default_error_condition().value() + << ", should be " << en + << "\n value() is " << ex.code().value() + << endl; + return true; + } + return false; + } + + boost::system::error_category* poison_category_aux() { return 0; } + boost::system::error_category& poison_category() { return *poison_category_aux(); } + + // compile-only two argument "do-the-right-thing" tests + // verifies that all overload combinations compile without error + void do_not_call() + { + fs::path p; + std::string s; + const char* a = 0; + fs::copy_file(p, p); + fs::copy_file(s, p); + fs::copy_file(a, p); + fs::copy_file(p, s); + fs::copy_file(p, a); + fs::copy_file(s, s); + fs::copy_file(a, s); + fs::copy_file(s, a); + fs::copy_file(a, a); + } + + void bad_file_size() + { + fs::file_size(" No way, Jose"); + } + + void bad_directory_size() + { + fs::file_size(fs::current_path()); + } + + fs::path bad_create_directory_path; + void bad_create_directory() + { + fs::create_directory(bad_create_directory_path); + } + + void bad_equivalent() + { + fs::equivalent("no-such-path", "another-not-present-path"); + } + + fs::path bad_remove_dir; + void bad_remove() + { + fs::remove(bad_remove_dir); + } + + class renamer + { + public: + renamer(const fs::path & p1, const fs::path & p2) + : from(p1), to(p2) {} + void operator()() + { + fs::rename(from, to); + } + private: + fs::path from; + fs::path to; + }; + + //------------------------------ debugging aids --------------------------------------// + + std::ostream& operator<<(std::ostream& os, const fs::file_status& s) + { + if (s.type() == fs::status_error) { os << "status_error"; } + else if (s.type() == fs::file_not_found) { os << "file_not_found"; } + else if (s.type() == fs::regular_file) { os << "regular_file"; } + else if (s.type() == fs::directory_file) { os << "directory_file"; } + else if (s.type() == fs::symlink_file) { os << "symlink_file"; } + else if (s.type() == fs::block_file) { os << "block_file"; } + else if (s.type() == fs::character_file) { os << "character_file"; } + else if (s.type() == fs::fifo_file) { os << "fifo_file"; } + else if (s.type() == fs::socket_file) { os << "socket_file"; } + else if (s.type() == fs::reparse_file) { os << "reparse_file"; } + else if (s.type() == fs::type_unknown) { os << "type_unknown"; } + else { os << "_detail_directory_symlink"; } + return os; + } + + void dump_tree(const fs::path & root) + { + cout << "dumping tree rooted at " << root << endl; + for (fs::recursive_directory_iterator it (root, fs::symlink_option::recurse); + it != fs::recursive_directory_iterator(); + ++it) + { + for (int i = 0; i <= it.level(); ++i) + cout << " "; + + cout << it->path(); + if (fs::is_symlink(it->path())) + { + cout << " [symlink]" << endl; + } + else + cout << endl; + } + } + + // exception_tests() ---------------------------------------------------------------// + + void exception_tests() + { + cout << "exception_tests..." << endl; + bool exception_thrown; + + // catch runtime_error by value + + cout << " catch runtime_error by value" << endl; + exception_thrown = false; + try + { + fs::create_directory("no-such-dir/foo/bar"); + } + catch (std::runtime_error x) + { + exception_thrown = true; + if (report_throws) cout << x.what() << endl; + if (platform == "Windows" && language_id == 0x0409) // English (United States) + // the stdcxx standard library apparently appends additional info + // to what(), so check only the initial portion: + BOOST_TEST(std::strncmp(x.what(), + "boost::filesystem::create_directory", + sizeof("boost::filesystem::create_directory")-1) == 0); + } + BOOST_TEST(exception_thrown); + + // catch system_error by value + + cout << " catch system_error by value" << endl; + exception_thrown = false; + try + { + fs::create_directory("no-such-dir/foo/bar"); + } + catch (system_error x) + { + exception_thrown = true; + if (report_throws) cout << x.what() << endl; + if (platform == "Windows" && language_id == 0x0409) // English (United States) + BOOST_TEST(std::strcmp(x.what(), + "boost::filesystem::create_directory: The system cannot find the path specified") == 0); + } + BOOST_TEST(exception_thrown); + + // catch filesystem_error by value + + cout << " catch filesystem_error by value" << endl; + exception_thrown = false; + try + { + fs::create_directory("no-such-dir/foo/bar"); + } + catch (fs::filesystem_error x) + { + exception_thrown = true; + if (report_throws) cout << x.what() << endl; + if (platform == "Windows" && language_id == 0x0409) // English (United States) + { + bool ok (std::strcmp(x.what(), + "boost::filesystem::create_directory: The system cannot find the path specified: \"no-such-dir/foo/bar\"") == 0); + BOOST_TEST(ok); + if (!ok) + { + cout << "what returns \"" << x.what() << "\"" << endl; + } + } + } + BOOST_TEST(exception_thrown); + + // catch filesystem_error by const reference + + cout << " catch filesystem_error by const reference" << endl; + exception_thrown = false; + try + { + fs::create_directory("no-such-dir/foo/bar"); + } + catch (const fs::filesystem_error & x) + { + exception_thrown = true; + if (report_throws) cout << x.what() << endl; + if (platform == "Windows" && language_id == 0x0409) // English (United States) + { + bool ok (std::strcmp(x.what(), + "boost::filesystem::create_directory: The system cannot find the path specified: \"no-such-dir/foo/bar\"") == 0); + BOOST_TEST(ok); + if (!ok) + { + cout << "what returns \"" << x.what() << "\"" << endl; + } + } + } + BOOST_TEST(exception_thrown); + + // the bound functions should throw, so CHECK_EXCEPTION() should return true + + BOOST_TEST(CHECK_EXCEPTION(bad_file_size, ENOENT)); + + if (platform == "Windows") + BOOST_TEST(CHECK_EXCEPTION(bad_directory_size, ENOENT)); + else + BOOST_TEST(CHECK_EXCEPTION(bad_directory_size, 0)); + + // test path::exception members + try { fs::file_size(ng); } // will throw + + catch (const fs::filesystem_error & ex) + { + BOOST_TEST(ex.path1().string() == " no-way, Jose"); + } + + cout << " exception_tests complete" << endl; + } + + // create a directory tree that can be used by subsequent tests ---------------------// + // + // dir + // d1 + // d1f1 // an empty file + // f0 // an empty file + // f1 // a file containing "file-f1" + + void create_tree() + { + cout << "creating test directories and files in " << dir << endl; + + // create directory d1 + BOOST_TEST(!fs::create_directory(dir)); + BOOST_TEST(!fs::is_symlink(dir)); + BOOST_TEST(!fs::is_symlink("nosuchfileordirectory")); + d1 = dir / "d1"; + BOOST_TEST(fs::create_directory(d1)); + BOOST_TEST(fs::exists(d1)); + BOOST_TEST(fs::is_directory(d1)); + BOOST_TEST(fs::is_empty(d1)); + + // create an empty file named "d1f1" + d1f1 = d1 / "d1f1"; + create_file(d1f1, ""); + BOOST_TEST(fs::exists(d1f1)); + BOOST_TEST(!fs::is_directory(d1f1)); + BOOST_TEST(fs::is_regular_file(d1f1)); + BOOST_TEST(fs::is_empty(d1f1)); + BOOST_TEST(fs::file_size(d1f1) == 0); + BOOST_TEST(fs::hard_link_count(d1f1) == 1); + + // create an empty file named "f0" + f0 = dir / "f0"; + create_file(f0, ""); + BOOST_TEST(fs::exists(f0)); + BOOST_TEST(!fs::is_directory(f0)); + BOOST_TEST(fs::is_regular_file(f0)); + BOOST_TEST(fs::is_empty(f0)); + BOOST_TEST(fs::file_size(f0) == 0); + BOOST_TEST(fs::hard_link_count(f0) == 1); + + // create a file named "f1" + f1 = dir / "f1"; + create_file(f1, "file-f1"); + BOOST_TEST(fs::exists(f1)); + BOOST_TEST(!fs::is_directory(f1)); + BOOST_TEST(fs::is_regular_file(f1)); + BOOST_TEST(fs::file_size(f1) == 7); + verify_file(f1, "file-f1"); + } + + // directory_iterator_tests --------------------------------------------------------// + + void directory_iterator_tests() + { + cout << "directory_iterator_tests..." << endl; + + bool dir_itr_exception(false); + try { fs::directory_iterator it(""); } + catch (const fs::filesystem_error &) { dir_itr_exception = true; } + BOOST_TEST(dir_itr_exception); + + error_code ec; + + BOOST_TEST(!ec); + fs::directory_iterator it("", ec); + BOOST_TEST(ec); + + dir_itr_exception = false; + try { fs::directory_iterator it("nosuchdirectory"); } + catch (const fs::filesystem_error &) { dir_itr_exception = true; } + BOOST_TEST(dir_itr_exception); + + ec.clear(); + fs::directory_iterator it2("nosuchdirectory", ec); + BOOST_TEST(ec); + + dir_itr_exception = false; + try + { + error_code ec; + fs::directory_iterator it("nosuchdirectory", ec); + BOOST_TEST(ec); + BOOST_TEST(ec == boost::system::errc::no_such_file_or_directory); + } + catch (const fs::filesystem_error &) { dir_itr_exception = true; } + BOOST_TEST(!dir_itr_exception); + + // create a second directory named d2 + d2 = dir / "d2"; + fs::create_directory(d2); + BOOST_TEST(fs::exists(d2)); + BOOST_TEST(fs::is_directory(d2)); + + // test the basic operation of directory_iterators, and test that + // stepping one iterator doesn't affect a different iterator. + { + typedef std::vector<fs::directory_entry> vec_type; + vec_type vec; + + fs::directory_iterator it1(dir); + BOOST_TEST(it1 != fs::directory_iterator()); + BOOST_TEST(fs::exists(it1->status())); + vec.push_back(*it1); + BOOST_TEST(*it1 == vec[0]); + + fs::directory_iterator it2(dir); + BOOST_TEST(it2 != fs::directory_iterator()); + BOOST_TEST(*it1 == *it2); + + ++it1; + BOOST_TEST(it1 != fs::directory_iterator()); + BOOST_TEST(fs::exists(it1->status())); + BOOST_TEST(it1 != it2); + BOOST_TEST(*it1 != vec[0]); + BOOST_TEST(*it2 == vec[0]); + vec.push_back(*it1); + + ++it1; + BOOST_TEST(it1 != fs::directory_iterator()); + BOOST_TEST(fs::exists(it1->status())); + BOOST_TEST(it1 != it2); + BOOST_TEST(*it2 == vec[0]); + vec.push_back(*it1); + + ++it1; + BOOST_TEST(it1 != fs::directory_iterator()); + BOOST_TEST(fs::exists(it1->status())); + BOOST_TEST(it1 != it2); + BOOST_TEST(*it2 == vec[0]); + vec.push_back(*it1); + + ++it1; + BOOST_TEST(it1 == fs::directory_iterator()); + + BOOST_TEST(*it2 == vec[0]); + ec.clear(); + it2.increment(ec); + BOOST_TEST(!ec); + BOOST_TEST(it2 != fs::directory_iterator()); + BOOST_TEST(it1 == fs::directory_iterator()); + BOOST_TEST(*it2 == vec[1]); + ++it2; + BOOST_TEST(*it2 == vec[2]); + BOOST_TEST(it1 == fs::directory_iterator()); + ++it2; + BOOST_TEST(*it2 == vec[3]); + ++it2; + BOOST_TEST(it1 == fs::directory_iterator()); + BOOST_TEST(it2 == fs::directory_iterator()); + + // sort vec and check that the right directory entries were found + std::sort(vec.begin(), vec.end()); + + BOOST_TEST_EQ(vec[0].path().filename().string(), std::string("d1")); + BOOST_TEST_EQ(vec[1].path().filename().string(), std::string("d2")); + BOOST_TEST_EQ(vec[2].path().filename().string(), std::string("f0")); + BOOST_TEST_EQ(vec[3].path().filename().string(), std::string("f1")); + } + + { // *i++ must meet the standard's InputIterator requirements + fs::directory_iterator dir_itr(dir); + BOOST_TEST(dir_itr != fs::directory_iterator()); + fs::path p = dir_itr->path(); + BOOST_TEST((*dir_itr++).path() == p); + BOOST_TEST(dir_itr != fs::directory_iterator()); + BOOST_TEST(dir_itr->path() != p); + + // test case reported in comment to SourceForge bug tracker [937606] + fs::directory_iterator it(dir); + const fs::path p1 = (*it++).path(); + BOOST_TEST(it != fs::directory_iterator()); + const fs::path p2 = (*it++).path(); + BOOST_TEST(p1 != p2); + ++it; + ++it; + BOOST_TEST(it == fs::directory_iterator()); + } + + // Windows has a tricky special case when just the root-name is given, + // causing the rest of the path to default to the current directory. + // Reported as S/F bug [ 1259176 ] + if (platform == "Windows") + { + fs::path root_name_path(fs::current_path().root_name()); + fs::directory_iterator it(root_name_path); + BOOST_TEST(it != fs::directory_iterator()); +// BOOST_TEST(fs::exists((*it).path())); + BOOST_TEST(fs::exists(it->path())); + BOOST_TEST(it->path().parent_path() == root_name_path); + bool found(false); + do + { + if (it->path().filename() == temp_dir_name) found = true; + } while (++it != fs::directory_iterator()); + BOOST_TEST(found); + } + + // there was an inital bug in directory_iterator that caused premature + // close of an OS handle. This block will detect regression. + { + fs::directory_iterator di; + { + di = fs::directory_iterator(dir); + } + BOOST_TEST(++di != fs::directory_iterator()); + } + + cout << " directory_iterator_tests complete" << endl; + } + + // recursive_directory_iterator_tests ----------------------------------------------// + + int walk_tree(bool recursive) + { + int d1f1_count = 0; + for (fs::recursive_directory_iterator it (dir, + recursive ? fs::symlink_option::recurse : fs::symlink_option::no_recurse); + it != fs::recursive_directory_iterator(); + ++it) + { + if (it->path().filename() == "d1f1") + ++d1f1_count; + } + return d1f1_count; + } + + void recursive_directory_iterator_tests() + { + cout << "recursive_directory_iterator_tests..." << endl; + BOOST_TEST(walk_tree(false) == 1); + if (create_symlink_ok) + BOOST_TEST(walk_tree(true) > 1); + + // test iterator increment with error_code argument + boost::system::error_code ec; + int d1f1_count = 0; + for (fs::recursive_directory_iterator it (dir, fs::symlink_option::no_recurse); + it != fs::recursive_directory_iterator(); + it.increment(ec)) + { + if (it->path().filename() == "d1f1") + ++d1f1_count; + } + BOOST_TEST(!ec); + BOOST_TEST(d1f1_count == 1); + + cout << " recursive_directory_iterator_tests complete" << endl; + } + + // iterator_status_tests -----------------------------------------------------------// + + void iterator_status_tests() + { + cout << "iterator_status_tests..." << endl; + + error_code ec; + // harmless if these fail: + fs::create_symlink(dir/"f0", dir/"f0_symlink", ec); + fs::create_symlink(dir/"no such file", dir/"dangling_symlink", ec); + fs::create_directory_symlink(dir/"d1", dir/"d1_symlink", ec); + fs::create_directory_symlink(dir/"no such directory", + dir/"dangling_directory_symlink", ec); + + for (fs::directory_iterator it(dir); + it != fs::directory_iterator(); ++it) + { + BOOST_TEST(fs::status(it->path()).type() == it->status().type()); + BOOST_TEST(fs::symlink_status(it->path()).type() == it->symlink_status().type()); + if (it->path().filename() == "d1") + { + BOOST_TEST(fs::is_directory(it->status())); + BOOST_TEST(fs::is_directory(it->symlink_status())); + } + else if (it->path().filename() == "d2") + { + BOOST_TEST(fs::is_directory(it->status())); + BOOST_TEST(fs::is_directory(it->symlink_status())); + } + else if (it->path().filename() == "f0") + { + BOOST_TEST(fs::is_regular_file(it->status())); + BOOST_TEST(fs::is_regular_file(it->symlink_status())); + } + else if (it->path().filename() == "f1") + { + BOOST_TEST(fs::is_regular_file(it->status())); + BOOST_TEST(fs::is_regular_file(it->symlink_status())); + } + else if (it->path().filename() == "f0_symlink") + { + BOOST_TEST(fs::is_regular_file(it->status())); + BOOST_TEST(fs::is_symlink(it->symlink_status())); + } + else if (it->path().filename() == "dangling_symlink") + { + BOOST_TEST(it->status().type() == fs::file_not_found); + BOOST_TEST(fs::is_symlink(it->symlink_status())); + } + else if (it->path().filename() == "d1_symlink") + { + BOOST_TEST(fs::is_directory(it->status())); + BOOST_TEST(fs::is_symlink(it->symlink_status())); + } + else if (it->path().filename() == "dangling_directory_symlink") + { + BOOST_TEST(it->status().type() == fs::file_not_found); + BOOST_TEST(fs::is_symlink(it->symlink_status())); + } + //else + // cout << " Note: unexpected directory entry " << it->path().filename() << endl; + } + } + + // recursive_iterator_status_tests -------------------------------------------------// + + void recursive_iterator_status_tests() + { + cout << "recursive_iterator_status_tests..." << endl; + for (fs::recursive_directory_iterator it (dir); + it != fs::recursive_directory_iterator(); + ++it) + { + BOOST_TEST(fs::status(it->path()).type() == it->status().type()); + BOOST_TEST(fs::symlink_status(it->path()).type() == it->symlink_status().type()); + } + } + + // create_hard_link_tests ----------------------------------------------------------// + + void create_hard_link_tests() + { + cout << "create_hard_link_tests..." << endl; + + fs::path from_ph(dir / "f3"); + fs::path f1(dir / "f1"); + + BOOST_TEST(!fs::exists(from_ph)); + BOOST_TEST(fs::exists(f1)); + bool create_hard_link_ok(true); + try { fs::create_hard_link(f1, from_ph); } + catch (const fs::filesystem_error & ex) + { + create_hard_link_ok = false; + cout + << " *** For information only ***\n" + " create_hard_link() attempt failed\n" + " filesystem_error.what() reports: " << ex.what() << "\n" + " create_hard_link() may not be supported on this file system\n"; + } + + if (create_hard_link_ok) + { + cout + << " *** For information only ***\n" + " create_hard_link() succeeded\n"; + BOOST_TEST(fs::exists(from_ph)); + BOOST_TEST(fs::exists(f1)); + BOOST_TEST(fs::equivalent(from_ph, f1)); + BOOST_TEST(fs::hard_link_count(from_ph) == 2); + BOOST_TEST(fs::hard_link_count(f1) == 2); + } + + // Although tests may be running on a FAT or other file system that does + // not support hard links, that is unusual enough that it is considered + // a test failure. + BOOST_TEST(create_hard_link_ok); + + error_code ec; + fs::create_hard_link(fs::path("doesnotexist"), + fs::path("shouldnotwork"), ec); + BOOST_TEST(ec); + } + + // create_symlink_tests ------------------------------------------------------------// + + void create_symlink_tests() + { + cout << "create_symlink_tests..." << endl; + + fs::path from_ph(dir / "f4"); + fs::path f1(dir / "f1"); + BOOST_TEST(!fs::exists(from_ph)); + BOOST_TEST(fs::exists(f1)); + try { fs::create_symlink(f1, from_ph); } + catch (const fs::filesystem_error & ex) + { + create_symlink_ok = false; + cout + << " *** For information only ***\n" + " create_symlink() attempt failed\n" + " filesystem_error.what() reports: " << ex.what() << "\n" + " create_symlink() may not be supported on this operating system or file system\n"; + } + + if (create_symlink_ok) + { + cout + << " *** For information only ***\n" + " create_symlink() succeeded\n"; + BOOST_TEST(fs::exists(from_ph)); + BOOST_TEST(fs::is_symlink(from_ph)); + BOOST_TEST(fs::exists(f1)); + BOOST_TEST(fs::equivalent(from_ph, f1)); + BOOST_TEST(fs::read_symlink(from_ph) == f1); + + fs::file_status stat = fs::symlink_status(from_ph); + BOOST_TEST(fs::exists(stat)); + BOOST_TEST(!fs::is_directory(stat)); + BOOST_TEST(!fs::is_regular_file(stat)); + BOOST_TEST(!fs::is_other(stat)); + BOOST_TEST(fs::is_symlink(stat)); + + stat = fs::status(from_ph); + BOOST_TEST(fs::exists(stat)); + BOOST_TEST(!fs::is_directory(stat)); + BOOST_TEST(fs::is_regular_file(stat)); + BOOST_TEST(!fs::is_other(stat)); + BOOST_TEST(!fs::is_symlink(stat)); + + // since create_symlink worked, copy_symlink should also work + fs::path symlink2_ph(dir / "symlink2"); + fs::copy_symlink(from_ph, symlink2_ph); + stat = fs::symlink_status(symlink2_ph); + BOOST_TEST(fs::is_symlink(stat)); + BOOST_TEST(fs::exists(stat)); + BOOST_TEST(!fs::is_directory(stat)); + BOOST_TEST(!fs::is_regular_file(stat)); + BOOST_TEST(!fs::is_other(stat)); + } + + error_code ec = error_code(); + fs::create_symlink("doesnotexist", "", ec); + BOOST_TEST(ec); + } + + // permissions_tests ---------------------------------------------------------------// + + void permissions_tests() + { + cout << "permissions_tests..." << endl; + + fs::path p(dir / "permissions.txt"); + create_file(p); + + if (platform == "POSIX") + { + cout << " fs::status(p).permissions() " << std::oct << fs::status(p).permissions() + << std::dec << endl; + BOOST_TEST((fs::status(p).permissions() & 0600) == 0600); // 0644, 0664 sometimes returned + + fs::permissions(p, fs::owner_all); + BOOST_TEST(fs::status(p).permissions() == fs::owner_all); + + fs::permissions(p, fs::add_perms | fs::group_all); + BOOST_TEST(fs::status(p).permissions() == (fs::owner_all | fs::group_all)); + + fs::permissions(p, fs::remove_perms | fs::group_all); + BOOST_TEST(fs::status(p).permissions() == fs::owner_all); + + // some POSIX platforms cache permissions during directory iteration, some don't + // so test that iteration finds the correct permissions + for (fs::directory_iterator itr(dir); itr != fs::directory_iterator(); ++itr) + if (itr->path().filename() == fs::path("permissions.txt")) + BOOST_TEST(itr->status().permissions() == fs::owner_all); + } + else // Windows + { + BOOST_TEST(fs::status(p).permissions() == 0666); + fs::permissions(p, fs::remove_perms | fs::group_write); + BOOST_TEST(fs::status(p).permissions() == 0444); + fs::permissions(p, fs::add_perms | fs::group_write); + BOOST_TEST(fs::status(p).permissions() == 0666); + } + } + + // rename_tests --------------------------------------------------------------------// + + void rename_tests() + { + cout << "rename_tests..." << endl; + + fs::path f1(dir / "f1"); + BOOST_TEST(fs::exists(f1)); + + // error: rename a non-existent old file + BOOST_TEST(!fs::exists(d1 / "f99")); + BOOST_TEST(!fs::exists(d1 / "f98")); + renamer n1a(d1 / "f99", d1 / "f98"); + BOOST_TEST(CHECK_EXCEPTION(n1a, ENOENT)); + renamer n1b(fs::path(""), d1 / "f98"); + BOOST_TEST(CHECK_EXCEPTION(n1b, ENOENT)); + + // error: rename an existing file to "" + renamer n2(f1, ""); + BOOST_TEST(CHECK_EXCEPTION(n2, ENOENT)); + + // rename an existing file to an existent file + create_file(dir / "ff1", "ff1"); + create_file(dir / "ff2", "ff2"); + fs::rename(dir / "ff2", dir / "ff1"); + BOOST_TEST(fs::exists(dir / "ff1")); + verify_file(dir / "ff1", "ff2"); + BOOST_TEST(!fs::exists(dir / "ff2")); + + // rename an existing file to itself + BOOST_TEST(fs::exists(dir / "f1")); + fs::rename(dir / "f1", dir / "f1"); + BOOST_TEST(fs::exists(dir / "f1")); + + // error: rename an existing directory to an existing non-empty directory + BOOST_TEST(fs::exists(dir / "f1")); + BOOST_TEST(fs::exists(d1 / "f2")); + // several POSIX implementations (cygwin, openBSD) report ENOENT instead of EEXIST, + // so we don't verify error type on the following test. + renamer n3b(dir, d1); + BOOST_TEST(CHECK_EXCEPTION(n3b, 0)); + + // error: move existing file to a nonexistent parent directory + BOOST_TEST(!fs::is_directory(dir / "f1")); + BOOST_TEST(!fs::exists(dir / "d3/f3")); + renamer n4a(dir / "f1", dir / "d3/f3"); + BOOST_TEST(CHECK_EXCEPTION(n4a, ENOENT)); + + // rename existing file in same directory + BOOST_TEST(fs::exists(d1 / "f2")); + BOOST_TEST(!fs::exists(d1 / "f50")); + fs::rename(d1 / "f2", d1 / "f50"); + BOOST_TEST(!fs::exists(d1 / "f2")); + BOOST_TEST(fs::exists(d1 / "f50")); + fs::rename(d1 / "f50", d1 / "f2"); + BOOST_TEST(fs::exists(d1 / "f2")); + BOOST_TEST(!fs::exists(d1 / "f50")); + + // move and rename an existing file to a different directory + fs::rename(d1 / "f2", d2 / "f3"); + BOOST_TEST(!fs::exists(d1 / "f2")); + BOOST_TEST(!fs::exists(d2 / "f2")); + BOOST_TEST(fs::exists(d2 / "f3")); + BOOST_TEST(!fs::is_directory(d2 / "f3")); + verify_file(d2 / "f3", "file-f1"); + fs::rename(d2 / "f3", d1 / "f2"); + BOOST_TEST(fs::exists(d1 / "f2")); + + // error: move existing directory to nonexistent parent directory + BOOST_TEST(fs::exists(d1)); + BOOST_TEST(!fs::exists(dir / "d3/d5")); + BOOST_TEST(!fs::exists(dir / "d3")); + renamer n5a(d1, dir / "d3/d5"); + BOOST_TEST(CHECK_EXCEPTION(n5a, ENOENT)); + + // rename existing directory + fs::path d3(dir / "d3"); + BOOST_TEST(fs::exists(d1)); + BOOST_TEST(fs::exists(d1 / "f2")); + BOOST_TEST(!fs::exists(d3)); + fs::rename(d1, d3); + BOOST_TEST(!fs::exists(d1)); + BOOST_TEST(fs::exists(d3)); + BOOST_TEST(fs::is_directory(d3)); + BOOST_TEST(!fs::exists(d1 / "f2")); + BOOST_TEST(fs::exists(d3 / "f2")); + fs::rename(d3, d1); + BOOST_TEST(fs::exists(d1)); + BOOST_TEST(fs::exists(d1 / "f2")); + BOOST_TEST(!fs::exists(d3)); + + // rename and move d1 to d2 / "d20" + BOOST_TEST(fs::exists(d1)); + BOOST_TEST(!fs::exists(d2 / "d20")); + BOOST_TEST(fs::exists(d1 / "f2")); + fs::rename(d1, d2 / "d20"); + BOOST_TEST(!fs::exists(d1)); + BOOST_TEST(fs::exists(d2 / "d20")); + BOOST_TEST(fs::exists(d2 / "d20" / "f2")); + fs::rename(d2 / "d20", d1); + BOOST_TEST(fs::exists(d1)); + BOOST_TEST(!fs::exists(d2 / "d20")); + BOOST_TEST(fs::exists(d1 / "f2")); + } + + // predicate_and_status_tests ------------------------------------------------------// + + void predicate_and_status_tests() + { + cout << "predicate_and_status_tests..." << endl; + + BOOST_TEST(!fs::exists(ng)); + BOOST_TEST(!fs::is_directory(ng)); + BOOST_TEST(!fs::is_regular_file(ng)); + BOOST_TEST(!fs::is_symlink(ng)); + fs::file_status stat(fs::status(ng)); + BOOST_TEST(fs::type_present(stat)); + BOOST_TEST(fs::permissions_present(stat)); + BOOST_TEST(fs::status_known(stat)); + BOOST_TEST(!fs::exists(stat)); + BOOST_TEST(!fs::is_directory(stat)); + BOOST_TEST(!fs::is_regular_file(stat)); + BOOST_TEST(!fs::is_other(stat)); + BOOST_TEST(!fs::is_symlink(stat)); + stat = fs::status(""); + BOOST_TEST(fs::type_present(stat)); + BOOST_TEST(fs::permissions_present(stat)); + BOOST_TEST(fs::status_known(stat)); + BOOST_TEST(!fs::exists(stat)); + BOOST_TEST(!fs::is_directory(stat)); + BOOST_TEST(!fs::is_regular_file(stat)); + BOOST_TEST(!fs::is_other(stat)); + BOOST_TEST(!fs::is_symlink(stat)); + } + + // create_directory_tests ----------------------------------------------------------// + + void create_directory_tests() + { + cout << "create_directory_tests..." << endl; + + // create a directory, then check it for consistency + // take extra care to report problems, since if this fails + // many subsequent tests will fail + try + { + fs::create_directory(dir); + } + + catch (const fs::filesystem_error & x) + { + cout << x.what() << "\n\n" + "***** Creating directory " << dir << " failed. *****\n" + "***** This is a serious error that will prevent further tests *****\n" + "***** from returning useful results. Further testing is aborted. *****\n\n"; + std::exit(1); + } + + catch (...) + { + cout << "\n\n" + "***** Creating directory " << dir << " failed. *****\n" + "***** This is a serious error that will prevent further tests *****\n" + "***** from returning useful results. Further testing is aborted. *****\n\n"; + std::exit(1); + } + + BOOST_TEST(fs::exists(dir)); + BOOST_TEST(fs::is_empty(dir)); + BOOST_TEST(fs::is_directory(dir)); + BOOST_TEST(!fs::is_regular_file(dir)); + BOOST_TEST(!fs::is_other(dir)); + BOOST_TEST(!fs::is_symlink(dir)); + fs::file_status stat = fs::status(dir); + BOOST_TEST(fs::exists(stat)); + BOOST_TEST(fs::is_directory(stat)); + BOOST_TEST(!fs::is_regular_file(stat)); + BOOST_TEST(!fs::is_other(stat)); + BOOST_TEST(!fs::is_symlink(stat)); + + cout << " create_directory_tests complete" << endl; + } + + // current_directory_tests ---------------------------------------------------------// + + void current_directory_tests() + { + cout << "current_directory_tests..." << endl; + + // set the current directory, then check it for consistency + fs::path original_dir = fs::current_path(); + BOOST_TEST(dir != original_dir); + fs::current_path(dir); + BOOST_TEST(fs::current_path() == dir); + BOOST_TEST(fs::current_path() != original_dir); + fs::current_path(original_dir); + BOOST_TEST(fs::current_path() == original_dir); + BOOST_TEST(fs::current_path() != dir); + + // make sure the overloads work + fs::current_path(dir.c_str()); + BOOST_TEST(fs::current_path() == dir); + BOOST_TEST(fs::current_path() != original_dir); + fs::current_path(original_dir.string()); + BOOST_TEST(fs::current_path() == original_dir); + BOOST_TEST(fs::current_path() != dir); + } + + // create_directories_tests --------------------------------------------------------// + + void create_directories_tests() + { + cout << "create_directories_tests..." << endl; + + fs::path p = dir / "level1" / "level2"; + + BOOST_TEST(!fs::exists(p)); + BOOST_TEST(fs::create_directories(p)); + BOOST_TEST(fs::exists(p)); + BOOST_TEST(fs::is_directory(p)); + } + + // resize_file_tests ---------------------------------------------------------------// + + void resize_file_tests() + { + cout << "resize_file_tests..." << endl; + + fs::path p(dir / "resize_file_test.txt"); + + fs::remove(p); + create_file(p, "1234567890"); + + BOOST_TEST(fs::exists(p)); + BOOST_TEST_EQ(fs::file_size(p), 10U); + fs::resize_file(p, 5); + BOOST_TEST(fs::exists(p)); + BOOST_TEST_EQ(fs::file_size(p), 5U); + fs::resize_file(p, 15); + BOOST_TEST(fs::exists(p)); + BOOST_TEST_EQ(fs::file_size(p), 15U); + + error_code ec; + fs::resize_file("no such file", 15, ec); + BOOST_TEST(ec); + } + + // status_of_nonexistent_tests -----------------------------------------------------// + + void status_of_nonexistent_tests() + { + cout << "status_of_nonexistent_tests..." << endl; + fs::path p ("nosuch"); + BOOST_TEST(!fs::exists(p)); + BOOST_TEST(!fs::is_regular_file(p)); + BOOST_TEST(!fs::is_directory(p)); + BOOST_TEST(!fs::is_symlink(p)); + BOOST_TEST(!fs::is_other(p)); + + fs::file_status s = fs::status(p); + BOOST_TEST(!fs::exists(s)); + BOOST_TEST_EQ(s.type(), fs::file_not_found); + BOOST_TEST(fs::type_present(s)); + BOOST_TEST(!fs::is_regular_file(s)); + BOOST_TEST(!fs::is_directory(s)); + BOOST_TEST(!fs::is_symlink(s)); + BOOST_TEST(!fs::is_other(s)); + } + + // status_error_reporting_tests ----------------------------------------------------// + + void status_error_reporting_tests() + { + cout << "status_error_reporting_tests..." << endl; + + error_code ec; + + // test status, ec, for existing file + ec.assign(-1,poison_category()); + BOOST_TEST(ec.value() == -1); + BOOST_TEST(&ec.category() == &poison_category()); + fs::file_status s = fs::status(".",ec); + BOOST_TEST(ec.value() == 0); + BOOST_TEST(ec.category() == system_category()); + BOOST_TEST(fs::exists(s)); + BOOST_TEST(fs::is_directory(s)); + + // test status, ec, for non-existing file + fs::path p ("nosuch"); + ec.assign(-1,poison_category()); + s = fs::status(p,ec); + BOOST_TEST(ec.value() != 0); + BOOST_TEST(ec.category() == system_category()); + + BOOST_TEST(!fs::exists(s)); + BOOST_TEST_EQ(s.type(), fs::file_not_found); + BOOST_TEST(fs::type_present(s)); + BOOST_TEST(!fs::is_regular_file(s)); + BOOST_TEST(!fs::is_directory(s)); + BOOST_TEST(!fs::is_symlink(s)); + BOOST_TEST(!fs::is_other(s)); + + // test queries, ec, for existing file + ec.assign(-1,poison_category()); + BOOST_TEST(fs::exists(".", ec)); + BOOST_TEST(ec.value() == 0); + BOOST_TEST(ec.category() == system_category()); + ec.assign(-1,poison_category()); + BOOST_TEST(!fs::is_regular_file(".", ec)); + BOOST_TEST(ec.value() == 0); + BOOST_TEST(ec.category() == system_category()); + ec.assign(-1,poison_category()); + BOOST_TEST(fs::is_directory(".", ec)); + BOOST_TEST(ec.value() == 0); + BOOST_TEST(ec.category() == system_category()); + + // test queries, ec, for non-existing file + ec.assign(-1,poison_category()); + BOOST_TEST(!fs::exists(p, ec)); + BOOST_TEST(ec.value() != 0); + BOOST_TEST(ec.category() == system_category()); + ec.assign(-1,poison_category()); + BOOST_TEST(!fs::is_regular_file(p, ec)); + BOOST_TEST(ec.value() != 0); + BOOST_TEST(ec.category() == system_category()); + ec.assign(-1,poison_category()); + BOOST_TEST(!fs::is_directory(p, ec)); + BOOST_TEST(ec.value() != 0); + BOOST_TEST(ec.category() == system_category()); + } + + // remove_tests --------------------------------------------------------------------// + + void remove_tests(const fs::path& dir) + { + cout << "remove_tests..." << endl; + + // remove() file + fs::path f1 = dir / "shortlife"; + BOOST_TEST(!fs::exists(f1)); + create_file(f1, ""); + BOOST_TEST(fs::exists(f1)); + BOOST_TEST(!fs::is_directory(f1)); + BOOST_TEST(fs::remove(f1)); + BOOST_TEST(!fs::exists(f1)); + BOOST_TEST(!fs::remove("no-such-file")); + BOOST_TEST(!fs::remove("no-such-directory/no-such-file")); + + // remove() directory + fs::path d1 = dir / "shortlife_dir"; + BOOST_TEST(!fs::exists(d1)); + fs::create_directory(d1); + BOOST_TEST(fs::exists(d1)); + BOOST_TEST(fs::is_directory(d1)); + BOOST_TEST(fs::is_empty(d1)); + bad_remove_dir = dir; + BOOST_TEST(CHECK_EXCEPTION(bad_remove, ENOTEMPTY)); + BOOST_TEST(fs::remove(d1)); + BOOST_TEST(!fs::exists(d1)); + } + + // remove_symlink_tests ------------------------------------------------------------// + + void remove_symlink_tests() + { + cout << "remove_symlink_tests..." << endl; + + // remove() dangling symbolic link + fs::path link("dangling_link"); + fs::remove(link); // remove any residue from past tests + BOOST_TEST(!fs::is_symlink(link)); + BOOST_TEST(!fs::exists(link)); + fs::create_symlink("nowhere", link); + BOOST_TEST(!fs::exists(link)); + BOOST_TEST(fs::is_symlink(link)); + BOOST_TEST(fs::remove(link)); + BOOST_TEST(!fs::is_symlink(link)); + + // remove() self-refering symbolic link + link = "link_to_self"; + fs::remove(link); // remove any residue from past tests + BOOST_TEST(!fs::is_symlink(link)); + BOOST_TEST(!fs::exists(link)); + fs::create_symlink(link, link); + BOOST_TEST(fs::remove(link)); + BOOST_TEST(!fs::exists(link)); + BOOST_TEST(!fs::is_symlink(link)); + + // remove() cyclic symbolic link + link = "link_to_a"; + fs::path link2("link_to_b"); + fs::remove(link); // remove any residue from past tests + fs::remove(link2); // remove any residue from past tests + BOOST_TEST(!fs::is_symlink(link)); + BOOST_TEST(!fs::exists(link)); + fs::create_symlink(link, link2); + fs::create_symlink(link2, link); + BOOST_TEST(fs::remove(link)); + BOOST_TEST(fs::remove(link2)); + BOOST_TEST(!fs::exists(link)); + BOOST_TEST(!fs::exists(link2)); + BOOST_TEST(!fs::is_symlink(link)); + + // remove() symbolic link to file + fs::path f1 = "link_target"; + fs::remove(f1); // remove any residue from past tests + BOOST_TEST(!fs::exists(f1)); + create_file(f1, ""); + BOOST_TEST(fs::exists(f1)); + BOOST_TEST(!fs::is_directory(f1)); + BOOST_TEST(fs::is_regular_file(f1)); + link = "non_dangling_link"; + fs::create_symlink(f1, link); + BOOST_TEST(fs::exists(link)); + BOOST_TEST(!fs::is_directory(link)); + BOOST_TEST(fs::is_regular_file(link)); + BOOST_TEST(fs::is_symlink(link)); + BOOST_TEST(fs::remove(link)); + BOOST_TEST(fs::exists(f1)); + BOOST_TEST(!fs::exists(link)); + BOOST_TEST(!fs::is_symlink(link)); + BOOST_TEST(fs::remove(f1)); + BOOST_TEST(!fs::exists(f1)); + } + + // absolute_tests -----------------------------------------------------------------// + + void absolute_tests() + { + cout << "absolute_tests..." << endl; + + BOOST_TEST_EQ(fs::absolute(""), fs::current_path() ); + BOOST_TEST_EQ(fs::absolute("", ""), fs::current_path() ); + BOOST_TEST_EQ(fs::absolute(fs::current_path() / "foo/bar"), fs::current_path() / "foo/bar"); + BOOST_TEST_EQ(fs::absolute("foo"), fs::current_path() / "foo"); + BOOST_TEST_EQ(fs::absolute("foo", fs::current_path()), fs::current_path() / "foo"); + BOOST_TEST_EQ(fs::absolute("bar", "foo"), fs::current_path() / "foo" / "bar"); + BOOST_TEST_EQ(fs::absolute("/foo"), fs::current_path().root_path().string() + "foo"); + +# ifdef BOOST_WINDOWS_API + BOOST_TEST_EQ(fs::absolute("a:foo", "b:/bar"), "a:/bar/foo"); +# endif + + // these tests were moved from elsewhere, so may duplicate some of the above tests + + // p.empty() + BOOST_TEST_EQ(fs::absolute(fs::path(), "//foo/bar"), "//foo/bar"); + if (platform == "Windows") + { + BOOST_TEST_EQ(fs::absolute(fs::path(), "a:/bar"), "a:/bar"); + } + + // p.has_root_name() + // p.has_root_directory() + BOOST_TEST_EQ(fs::absolute(fs::path("//foo/bar"), "//uvw/xyz"), "//foo/bar"); + if (platform == "Windows") + { + BOOST_TEST_EQ(fs::absolute(fs::path("a:/bar"), "b:/xyz"), "a:/bar"); + } + // !p.has_root_directory() + BOOST_TEST_EQ(fs::absolute(fs::path("//net"), "//xyz/"), "//net/"); + BOOST_TEST_EQ(fs::absolute(fs::path("//net"), "//xyz/abc"), "//net/abc"); + BOOST_TEST_EQ(fs::absolute(fs::path("//net"), "//xyz/abc/def"), "//net/abc/def"); + if (platform == "Windows") + { + BOOST_TEST_EQ(fs::absolute(fs::path("a:"), "b:/"), "a:/"); + BOOST_TEST_EQ(fs::absolute(fs::path("a:"),"b:/abc"), "a:/abc"); + BOOST_TEST_EQ(fs::absolute(fs::path("a:"),"b:/abc/def"), "a:/abc/def"); + BOOST_TEST_EQ(fs::absolute(fs::path("a:foo"), "b:/"), "a:/foo"); + BOOST_TEST_EQ(fs::absolute(fs::path("a:foo"), "b:/abc"), "a:/abc/foo"); + BOOST_TEST_EQ(fs::absolute(fs::path("a:foo"), "b:/abc/def"), "a:/abc/def/foo"); + BOOST_TEST_EQ(fs::absolute(fs::path("a:foo/bar"), "b:/"), "a:/foo/bar"); + BOOST_TEST_EQ(fs::absolute(fs::path("a:foo/bar"), "b:/abc"), "a:/abc/foo/bar"); + BOOST_TEST_EQ(fs::absolute(fs::path("a:foo/bar"), "b:/abc/def"), "a:/abc/def/foo/bar"); + } + // !p.has_root_name() + // p.has_root_directory() + BOOST_TEST_EQ(fs::absolute(fs::path("/"), "//xyz/"), "//xyz/"); + BOOST_TEST_EQ(fs::absolute(fs::path("/"), "//xyz/abc"), "//xyz/"); + BOOST_TEST_EQ(fs::absolute(fs::path("/foo"), "//xyz/"), "//xyz/foo"); + BOOST_TEST_EQ(fs::absolute(fs::path("/foo"), "//xyz/abc"), "//xyz/foo"); + // !p.has_root_directory() + BOOST_TEST_EQ(fs::absolute(fs::path("foo"), "//xyz/abc"), "//xyz/abc/foo"); + BOOST_TEST_EQ(fs::absolute(fs::path("foo/bar"), "//xyz/abc"), "//xyz/abc/foo/bar"); + BOOST_TEST_EQ(fs::absolute(fs::path("."), "//xyz/abc"), "//xyz/abc/."); + BOOST_TEST_EQ(fs::absolute(fs::path(".."), "//xyz/abc"), "//xyz/abc/.."); + BOOST_TEST_EQ(fs::absolute(fs::path("./foo"), "//xyz/abc"), "//xyz/abc/./foo"); + BOOST_TEST_EQ(fs::absolute(fs::path("../foo"), "//xyz/abc"), "//xyz/abc/../foo"); + if (platform == "POSIX") + { + BOOST_TEST_EQ(fs::absolute(fs::path("foo"), "/abc"), "/abc/foo"); + BOOST_TEST_EQ(fs::absolute(fs::path("foo/bar"), "/abc"), "/abc/foo/bar"); + BOOST_TEST_EQ(fs::absolute(fs::path("."), "/abc"), "/abc/."); + BOOST_TEST_EQ(fs::absolute(fs::path(".."), "/abc"), "/abc/.."); + BOOST_TEST_EQ(fs::absolute(fs::path("./foo"), "/abc"), "/abc/./foo"); + BOOST_TEST_EQ(fs::absolute(fs::path("../foo"), "/abc"), "/abc/../foo"); + } + + } + + // canonical_basic_tests -----------------------------------------------------------// + + void canonical_basic_tests() + { + cout << "canonical_basic_tests..." << endl; + + // error handling + error_code ec; + ec.clear(); + fs::canonical("no-such-file", ec); + BOOST_TEST(ec); + ec.clear(); + fs::canonical("no-such-file", "x", ec); + BOOST_TEST(ec); + bool ok(false); + try { fs::canonical("no-such-file"); } + catch (const fs::filesystem_error&) { ok = true; } + BOOST_TEST(ok); + + // non-symlink tests; also see canonical_symlink_tests() + BOOST_TEST_EQ(fs::canonical(""), fs::current_path()); + BOOST_TEST_EQ(fs::canonical("", fs::current_path()), fs::current_path()); + BOOST_TEST_EQ(fs::canonical("", ""), fs::current_path()); + BOOST_TEST_EQ(fs::canonical(fs::current_path()), fs::current_path()); + BOOST_TEST_EQ(fs::canonical(fs::current_path(), ""), fs::current_path()); + BOOST_TEST_EQ(fs::canonical(fs::current_path(), "no-such-file"), fs::current_path()); + + BOOST_TEST_EQ(fs::canonical("."), fs::current_path()); + BOOST_TEST_EQ(fs::canonical(".."), fs::current_path().parent_path()); + BOOST_TEST_EQ(fs::canonical("/"), fs::current_path().root_path()); + + fs::path relative_dir(dir.filename()); + BOOST_TEST_EQ(fs::canonical(dir), dir); + BOOST_TEST_EQ(fs::canonical(relative_dir), dir); + BOOST_TEST_EQ(fs::canonical(dir / "f0"), dir / "f0"); + BOOST_TEST_EQ(fs::canonical(relative_dir / "f0"), dir / "f0"); + BOOST_TEST_EQ(fs::canonical(relative_dir / "./f0"), dir / "f0"); + BOOST_TEST_EQ(fs::canonical(relative_dir / "d1/../f0"), dir / "f0"); + } + + // canonical_symlink_tests -----------------------------------------------------------// + + void canonical_symlink_tests() + { + cout << "canonical_symlink_tests..." << endl; + + fs::path relative_dir(dir.filename()); + BOOST_TEST_EQ(fs::canonical(dir / "sym-d1/f2"), d1 / "f2"); + BOOST_TEST_EQ(fs::canonical(relative_dir / "sym-d1/f2"), d1 / "f2"); + } + + // copy_file_tests ------------------------------------------------------------------// + + void copy_file_tests(const fs::path& f1, const fs::path& d1) + { + cout << "copy_file_tests..." << endl; + + BOOST_TEST(fs::exists(f1)); + fs::remove(d1 / "f2"); // remove possible residue from prior testing + BOOST_TEST(fs::exists(d1)); + BOOST_TEST(!fs::exists(d1 / "f2")); + cout << " copy " << f1 << " to " << d1 / "f2" << endl; + fs::copy_file(f1, d1 / "f2"); + cout << " copy complete" << endl; + BOOST_TEST(fs::exists(f1)); + BOOST_TEST(fs::exists(d1 / "f2")); + BOOST_TEST(!fs::is_directory(d1 / "f2")); + verify_file(d1 / "f2", "file-f1"); + + bool copy_ex_ok = false; + try { fs::copy_file(f1, d1 / "f2"); } + catch (const fs::filesystem_error &) { copy_ex_ok = true; } + BOOST_TEST(copy_ex_ok); + + copy_ex_ok = false; + try { fs::copy_file(f1, d1 / "f2", fs::copy_option::fail_if_exists); } + catch (const fs::filesystem_error &) { copy_ex_ok = true; } + BOOST_TEST(copy_ex_ok); + + create_file(d1 / "f2", "1234567890"); + BOOST_TEST_EQ(fs::file_size(d1 / "f2"), 10U); + copy_ex_ok = true; + try { fs::copy_file(f1, d1 / "f2", fs::copy_option::overwrite_if_exists); } + catch (const fs::filesystem_error &) { copy_ex_ok = false; } + BOOST_TEST(copy_ex_ok); + BOOST_TEST_EQ(fs::file_size(d1 / "f2"), 7U); + verify_file(d1 / "f2", "file-f1"); + } + + // symlink_status_tests -------------------------------------------------------------// + + void symlink_status_tests() + { + cout << "symlink_status_tests..." << endl; + + boost::system::error_code ec; + + fs::path dangling_sym(dir / "dangling-sym"); + fs::path dangling_directory_sym(dir / "dangling-directory-sym"); + fs::path sym_d1(dir / "sym-d1"); + fs::path symsym_d1(dir / "symsym-d1"); + fs::path sym_f1(dir / "sym-f1"); + fs::path symsym_f1(dir / "symsym-f1"); + fs::create_symlink("does not exist", dangling_sym); + fs::create_directory_symlink("does not exist", dangling_directory_sym); + fs::create_directory_symlink(d1, sym_d1); + fs::create_directory_symlink(sym_d1, symsym_d1); + fs::create_symlink(f1, sym_f1); + fs::create_symlink(sym_f1, symsym_f1); + + // verify all cases detected as symlinks + BOOST_TEST_EQ(fs::symlink_status(dangling_sym, ec).type(), fs::symlink_file); + BOOST_TEST_EQ(fs::symlink_status(dangling_directory_sym, ec).type(), fs::symlink_file); + BOOST_TEST_EQ(fs::symlink_status(sym_d1, ec).type(), fs::symlink_file); + BOOST_TEST_EQ(fs::symlink_status(symsym_d1, ec).type(), fs::symlink_file); + BOOST_TEST_EQ(fs::symlink_status(sym_f1, ec).type(), fs::symlink_file); + BOOST_TEST_EQ(fs::symlink_status(symsym_f1, ec).type(), fs::symlink_file); + + // verify all cases resolve to the (possibly recursive) symlink target + BOOST_TEST_EQ(fs::status(dangling_sym, ec).type(), fs::file_not_found); + BOOST_TEST_EQ(fs::status(dangling_directory_sym, ec).type(), fs::file_not_found); + + BOOST_TEST_EQ(fs::status(sym_d1, ec).type(), fs::directory_file); + BOOST_TEST_EQ(fs::status(sym_d1 / "d1f1", ec).type(), fs::regular_file); + BOOST_TEST_EQ(fs::status(symsym_d1, ec).type(), fs::directory_file); + BOOST_TEST_EQ(fs::status(symsym_d1 / "d1f1", ec).type(), fs::regular_file); + BOOST_TEST_EQ(fs::status(sym_f1, ec).type(), fs::regular_file); + BOOST_TEST_EQ(fs::status(symsym_f1, ec).type(), fs::regular_file); + +#ifdef BOOST_WINDOWS_API + + // On Windows, telling if a filesystem entry is a symlink, rather than some other + // kind of reparse point such as a junction, requires some truely baroque code. + // See ticket #4663, filesystem objects falsely identified as symlinks. + // This test checks two directory entries created by Windows itself to verify + // is_symlink() works correctly. Try "dir /A %HOMEPATH%\.." from the command line to + // verify this test is valid on your version of Windows. It only works on Vista and + // later. + + fs::path users(getenv("HOMEDRIVE")); + BOOST_TEST(!users.empty()); + users /= "\\Users"; + BOOST_TEST(fs::exists(users)); + BOOST_TEST(fs::exists(users/"All Users")); + BOOST_TEST(fs::exists(users/"Default User")); + BOOST_TEST(fs::is_symlink(users/"All Users")); // dir /A reports <SYMLINKD> + BOOST_TEST(!fs::is_symlink(users/"Default User")); // dir /A reports <JUNCTION> <JUNCTION> + +#endif + } + + // copy_symlink_tests ---------------------------------------------------------------// + + void copy_symlink_tests(const fs::path& f1, const fs::path& d1) + { + cout << "copy_symlink_tests..." << endl; + + BOOST_TEST(fs::exists(f1)); + BOOST_TEST(fs::exists(d1)); + fs::path sym1(d1 / "symlink1"); + fs::remove(sym1); // remove possible residue from prior testing + fs::create_symlink(f1, sym1); + BOOST_TEST(fs::exists(sym1)); + BOOST_TEST(fs::is_symlink(sym1)); + fs::path sym2(d1 / "symlink2"); + fs::copy_symlink(sym1, sym2); + BOOST_TEST(fs::exists(sym2)); + BOOST_TEST(fs::is_symlink(sym2)); + //fs::path sym3(d1 / "symlink3"); + //fs::copy(sym1, sym3); + //BOOST_TEST(fs::exists(sym3)); + //BOOST_TEST(fs::is_symlink(sym3)); + + bool copy_ex_ok = false; + try { fs::copy_symlink("no-such-file", "new-symlink1"); } + catch (const fs::filesystem_error &) { copy_ex_ok = true; } + BOOST_TEST(copy_ex_ok); + + copy_ex_ok = false; + try { fs::copy_symlink(f1, "new-symlink2"); } // should fail; f1 not symlink + catch (const fs::filesystem_error &) { copy_ex_ok = true; } + BOOST_TEST(copy_ex_ok); + } + + // write_time_tests ----------------------------------------------------------------// + + void write_time_tests(const fs::path& dir) + { + cout << "write_time_tests..." << endl; + + fs::path f1 = dir / "foobar2"; + create_file(f1, "foobar2"); + BOOST_TEST(fs::exists(f1)); + BOOST_TEST(!fs::is_directory(f1)); + BOOST_TEST(fs::is_regular_file(f1)); + BOOST_TEST(fs::file_size(f1) == 7); + verify_file(f1, "foobar2"); + + // Some file system report last write time as local (FAT), while + // others (NTFS) report it as UTC. The C standard does not specify + // if time_t is local or UTC. + + std::time_t ft = fs::last_write_time(f1); + cout << "\n UTC last_write_time() for a file just created is " + << std::asctime(std::gmtime(&ft)) << endl; + + std::tm * tmp = std::localtime(&ft); + cout << "\n Year is " << tmp->tm_year << endl; + --tmp->tm_year; + cout << " Change year to " << tmp->tm_year << endl; + fs::last_write_time(f1, std::mktime(tmp)); + std::time_t ft2 = fs::last_write_time(f1); + cout << " last_write_time() for the file is now " + << std::asctime(std::gmtime(&ft2)) << endl; + BOOST_TEST(ft != fs::last_write_time(f1)); + + cout << "\n Reset to current time" << endl; + fs::last_write_time(f1, ft); + double time_diff = std::difftime(ft, fs::last_write_time(f1)); + cout + << " original last_write_time() - current last_write_time() is " + << time_diff << " seconds" << endl; + BOOST_TEST(time_diff >= -60.0 && time_diff <= 60.0); + } + + // platform_specific_tests ---------------------------------------------------------// + + void platform_specific_tests() + { + // Windows only tests + if (platform == "Windows") + { + cout << "Window specific tests..." << endl; + if (!skip_long_windows_tests) + { + cout << " (may take several seconds)"<< endl; + + BOOST_TEST(!fs::exists(fs::path("//share-not"))); + BOOST_TEST(!fs::exists(fs::path("//share-not/"))); + BOOST_TEST(!fs::exists(fs::path("//share-not/foo"))); + } + cout << endl; + + BOOST_TEST(!fs::exists("tools/jam/src/:sys:stat.h")); // !exists() if ERROR_INVALID_NAME + BOOST_TEST(!fs::exists(":sys:stat.h")); // !exists() if ERROR_INVALID_PARAMETER + BOOST_TEST(dir.string().size() > 1 + && dir.string()[1] == ':'); // verify path includes drive + + BOOST_TEST(fs::system_complete("").empty()); + BOOST_TEST(fs::system_complete("/") == fs::initial_path().root_path()); + BOOST_TEST(fs::system_complete("foo") + == fs::initial_path() / "foo"); + + fs::path p1(fs::system_complete("/foo")); + BOOST_TEST_EQ(p1.string().size(), 6U); // this failed during v3 development due to bug + std::string s1(p1.string() ); + std::string s2(fs::initial_path().root_path().string()+"foo"); + BOOST_TEST_EQ(s1, s2); + + BOOST_TEST(fs::system_complete(fs::path(fs::initial_path().root_name())) + == fs::initial_path()); + BOOST_TEST(fs::system_complete(fs::path(fs::initial_path().root_name().string() + + "foo")).string() == fs::initial_path() / "foo"); + BOOST_TEST(fs::system_complete(fs::path("c:/")).generic_string() + == "c:/"); + BOOST_TEST(fs::system_complete(fs::path("c:/foo")).generic_string() + == "c:/foo"); + BOOST_TEST(fs::system_complete(fs::path("//share")).generic_string() + == "//share"); + } // Windows + + else if (platform == "POSIX") + { + cout << "POSIX specific tests..." << endl; + BOOST_TEST(fs::system_complete("").empty()); + BOOST_TEST(fs::initial_path().root_path().string() == "/"); + BOOST_TEST(fs::system_complete("/").string() == "/"); + BOOST_TEST(fs::system_complete("foo").string() + == fs::initial_path().string()+"/foo"); + BOOST_TEST(fs::system_complete("/foo").string() + == fs::initial_path().root_path().string()+"foo"); + } // POSIX + } + + // initial_tests -------------------------------------------------------------------// + + void initial_tests() + { + cout << "initial_tests..." << endl; + + cout << " current_path().string() is\n \"" + << fs::initial_path().string() + << "\"\n\n"; + BOOST_TEST(fs::initial_path() == fs::current_path()); + BOOST_TEST(fs::initial_path().is_absolute()); + BOOST_TEST(fs::current_path().is_absolute()); + BOOST_TEST(fs::initial_path().string() + == fs::current_path().string()); + } + + // space_tests ---------------------------------------------------------------------// + + void space_tests() + { + cout << "space_tests..." << endl; + + // make some reasonable assuptions for testing purposes + fs::space_info spi(fs::space(dir)); + BOOST_TEST(spi.capacity > 1000000); + BOOST_TEST(spi.free > 1000); + BOOST_TEST(spi.capacity > spi.free); + BOOST_TEST(spi.free >= spi.available); + + // it is convenient to display space, but older VC++ versions choke +# if !defined(BOOST_MSVC) || _MSC_VER >= 1300 // 1300 == VC++ 7.0 + cout << " capacity = " << spi.capacity << '\n'; + cout << " free = " << spi.free << '\n'; + cout << " available = " << spi.available << '\n'; +# endif + } + + // equivalent_tests ----------------------------------------------------------------// + + void equivalent_tests(const fs::path& f1) + { + cout << "equivalent_tests..." << endl; + + BOOST_TEST(CHECK_EXCEPTION(bad_equivalent, ENOENT)); + BOOST_TEST(fs::equivalent(f1, dir / "f1")); + BOOST_TEST(fs::equivalent(dir, d1 / "..")); + BOOST_TEST(!fs::equivalent(f1, dir)); + BOOST_TEST(!fs::equivalent(dir, f1)); + BOOST_TEST(!fs::equivalent(d1, d2)); + BOOST_TEST(!fs::equivalent(dir, ng)); + BOOST_TEST(!fs::equivalent(ng, dir)); + BOOST_TEST(!fs::equivalent(f1, ng)); + BOOST_TEST(!fs::equivalent(ng, f1)); + } + + // temp_directory_path_tests -------------------------------------------------------// + // contributed by Jeff Flinn + + struct guarded_env_var + { + struct previous_value + { + std::string m_name; + std::string m_string; + bool m_empty; + + previous_value(const char* name) + : m_string(name) + , m_empty (true) + { + if(const char* value = getenv(name)) + { + m_string.assign(value); + m_empty = false; + } + else + { + m_empty = true; + } + } + ~previous_value() + { + m_empty? unsetenv(m_name.c_str()) + : setenv(m_name.c_str(), m_string.c_str(), 1); + } + }; + + previous_value m_previous_value; + + guarded_env_var(const char* name, const fs::path::value_type* value) + : m_previous_value(name) + { + value? setenv(name, value, 1) : unsetenv(name); + } + }; + + void temp_directory_path_tests() + { + { + cout << "temp_directory_path_tests..." << endl; + + BOOST_TEST(!fs::temp_directory_path().empty()); + BOOST_TEST(exists(fs::temp_directory_path())); + fs::path ph = fs::temp_directory_path()/"temp_directory_path_test.txt"; + { + if(exists(ph)) remove(ph); + std::ofstream f(ph.BOOST_FILESYSTEM_C_STR); + f << "passed"; + } + BOOST_TEST(exists(ph)); + { + std::ifstream f(ph.BOOST_FILESYSTEM_C_STR); + std::string s; + f >> s; + BOOST_TEST(s == "passed"); + } + remove(ph); + BOOST_TEST(!exists(ph)); + } + + fs::path test_temp_dir = fs::initial_path(); + +#if defined BOOST_POSIX_API + { + struct guarded_tmp_vars + { + guarded_env_var m_tmpdir ; + guarded_env_var m_tmp ; + guarded_env_var m_temp ; + guarded_env_var m_tempdir; + + guarded_tmp_vars + ( const fs::path::value_type* tmpdir + , const fs::path::value_type* tmp + , const fs::path::value_type* temp + , const fs::path::value_type* tempdir + ) + : m_tmpdir ("TMPDIR" , tmpdir ) + , m_tmp ("TMP" , tmp ) + , m_temp ("TEMP" , temp ) + , m_tempdir("TEMPDIR", tempdir) + {} + }; + + { + guarded_tmp_vars vars(test_temp_dir.c_str(), 0, 0, 0); + fs::path ph = fs::temp_directory_path(); + BOOST_TEST(equivalent(test_temp_dir, ph)); + } + { + guarded_tmp_vars vars(0, test_temp_dir.c_str(), 0, 0); + fs::path ph = fs::temp_directory_path(); + BOOST_TEST(equivalent(test_temp_dir, ph)); + } + { + guarded_tmp_vars vars(0, 0, test_temp_dir.c_str(), 0); + fs::path ph = fs::temp_directory_path(); + BOOST_TEST(equivalent(test_temp_dir, ph)); + } + { + guarded_tmp_vars vars(0, 0, 0, test_temp_dir.c_str()); + fs::path ph = fs::temp_directory_path(); + BOOST_TEST(equivalent(test_temp_dir, ph)); + } + } +#endif + +#if defined BOOST_WINDOWS_API + { + struct guarded_tmp_vars + { + guarded_env_var m_tmp ; + guarded_env_var m_temp ; + guarded_env_var m_userprofile; + + guarded_tmp_vars + ( const fs::path::value_type* tmp + , const fs::path::value_type* temp + , const fs::path::value_type* userprofile + ) + : m_tmp ("TMP" , tmp ) + , m_temp ("TEMP" , temp ) + , m_userprofile("USERPROFILE", userprofile) + {} + }; + + // should NEVER throw - the windows directory or current_path always exists + { + guarded_tmp_vars vars(0, 0, 0); + fs::path ph = fs::temp_directory_path(); + + BOOST_TEST(test_temp_dir != ph); + } + + // should NEVER fail - the windows directory or current_path always exists + { + guarded_tmp_vars vars(0, 0, 0); + error_code ec; + fs::path ph = fs::temp_directory_path(ec); + BOOST_TEST(!ec); + } + + { + guarded_tmp_vars vars(test_temp_dir.c_str(), 0, 0); + fs::path ph = fs::temp_directory_path(); + BOOST_TEST(equivalent(test_temp_dir, ph)); + } + { + guarded_tmp_vars vars(0, test_temp_dir.c_str(), 0); + fs::path ph = fs::temp_directory_path(); + BOOST_TEST(equivalent(test_temp_dir, ph)); + } + { + guarded_tmp_vars vars(0, 0, test_temp_dir.c_str()); + fs::path ph = fs::temp_directory_path(); + BOOST_TEST(equivalent(test_temp_dir, ph)); + } + } +#endif + } + + // _tests --------------------------------------------------------------------------// + + void _tests() + { + cout << "_tests..." << endl; + } + +} // unnamed namespace + + //------------------------------------------------------------------------------------// + // // + // main // + // // + //------------------------------------------------------------------------------------// + +int cpp_main(int argc, char* argv[]) +{ +// document state of critical macros +#ifdef BOOST_POSIX_API + cout << "BOOST_POSIX_API is defined\n"; +#endif +#ifdef BOOST_WINDOWS_API + cout << "BOOST_WINDOWS_API is defined\n"; +#endif + + for (; argc > 1; --argc, ++argv) + { + if (*argv[1]=='-' && *(argv[1]+1)=='t') + report_throws = true; + else if (*argv[1]=='-' && *(argv[1]+1)=='x') + cleanup = false; + else if (*argv[1]=='-' && *(argv[1]+1)=='w') + skip_long_windows_tests = true; + } + + // The choice of platform to test is make at runtime rather than compile-time + // so that compile errors for all platforms will be detected even though + // only the current platform is runtime tested. +# if defined(BOOST_POSIX_API) + platform = "POSIX"; +# elif defined(BOOST_WINDOWS_API) + platform = "Windows"; +# if !defined(__MINGW32__) && !defined(__CYGWIN__) + language_id = ::GetUserDefaultUILanguage(); +# else + language_id = 0x0409; // Assume US English +# endif +# else +# error neither BOOST_POSIX_API nor BOOST_WINDOWS_API is defined. See boost/system/api_config.hpp +# endif + cout << "API is " << platform << endl; + + dir = fs::initial_path() / temp_dir_name; + + if (fs::exists(dir)) + { + cout << "remove residue from prior failed tests..." << endl; + fs::remove_all(dir); + } + BOOST_TEST(!fs::exists(dir)); + + // several functions give unreasonable results if uintmax_t isn't 64-bits + cout << "sizeof(boost::uintmax_t) = " << sizeof(boost::uintmax_t) << '\n'; + BOOST_TEST(sizeof(boost::uintmax_t) >= 8); + + initial_tests(); + predicate_and_status_tests(); + exception_tests(); + platform_specific_tests(); + create_directory_tests(); + current_directory_tests(); + space_tests(); + + // create a directory tree that can be used by subsequent tests + // + // dir + // d1 + // d1f1 // an empty file + // f0 // an empty file + // f1 // a file containing "file f1" + // + create_tree(); + + status_of_nonexistent_tests(); + status_error_reporting_tests(); + directory_iterator_tests(); + create_directories_tests(); // must run AFTER directory_iterator_tests + + bad_create_directory_path = f1; + BOOST_TEST(CHECK_EXCEPTION(bad_create_directory, EEXIST)); + fs::file_status stat = fs::status(f1); + BOOST_TEST(fs::status_known(stat)); + BOOST_TEST(fs::exists(stat)); + BOOST_TEST(!fs::is_directory(stat)); + BOOST_TEST(fs::is_regular_file(stat)); + BOOST_TEST(!fs::is_other(stat)); + BOOST_TEST(!fs::is_symlink(stat)); + + equivalent_tests(f1); + create_hard_link_tests(); + create_symlink_tests(); + resize_file_tests(); + absolute_tests(); + canonical_basic_tests(); + permissions_tests(); + copy_file_tests(f1, d1); + if (create_symlink_ok) // only if symlinks supported + { + symlink_status_tests(); + copy_symlink_tests(f1, d1); + canonical_symlink_tests(); + } + iterator_status_tests(); // lots of cases by now, so a good time to test +// dump_tree(dir); + recursive_directory_iterator_tests(); + recursive_iterator_status_tests(); // lots of cases by now, so a good time to test + rename_tests(); + remove_tests(dir); + if (create_symlink_ok) // only if symlinks supported + remove_symlink_tests(); + write_time_tests(dir); + + temp_directory_path_tests(); + + cout << "testing complete" << endl; + + // post-test cleanup + if (cleanup) + { + cout << "post-test removal of " << dir << endl; + BOOST_TEST(fs::remove_all(dir) != 0); + // above was added just to simplify testing, but it ended up detecting + // a bug (failure to close an internal search handle). + cout << "post-test removal complete" << endl; + BOOST_TEST(!fs::exists(dir)); + BOOST_TEST(fs::remove_all(dir) == 0); + } + + cout << "returning from main()" << endl; + return ::boost::report_errors(); +} // main diff --git a/libs/filesystem/v3/test/operations_unit_test.cpp b/libs/filesystem/v3/test/operations_unit_test.cpp new file mode 100644 index 0000000000..b592fd93ed --- /dev/null +++ b/libs/filesystem/v3/test/operations_unit_test.cpp @@ -0,0 +1,265 @@ +// operations_unit_test.cpp ----------------------------------------------------------// + +// Copyright Beman Dawes 2008, 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +// ------------------------------------------------------------------------------------// + +// This program is misnamed - it is really a smoke test rather than a unit_test + +// ------------------------------------------------------------------------------------// + +#define BOOST_FILESYSTEM_VERSION 3 + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/config/warning_disable.hpp> + +// See deprecated_test for tests of deprecated features +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +# define BOOST_FILESYSTEM_NO_DEPRECATED +#endif +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem.hpp> // make sure filesystem.hpp works +#include <boost/system/error_code.hpp> +#include <boost/detail/lightweight_test.hpp> +#include <boost/detail/lightweight_main.hpp> +#include <iostream> + +using namespace boost::filesystem; +using namespace boost::system; +using std::cout; +using std::endl; +using std::string; + +#define CHECK(x) check(x, __FILE__, __LINE__) + +namespace +{ + + void check(bool ok, const char* file, int line) + { + if (ok) return; + + ++::boost::detail::test_errors(); + + cout << file << '(' << line << "): test failed\n"; + } + + // file_status_test ----------------------------------------------------------------// + + void file_status_test() + { + cout << "file_status test..." << endl; + + file_status s = status("."); + int v = s.permissions(); + cout << " status(\".\") permissions are " + << std::oct << (v & 0777) << std::dec << endl; + CHECK((v & 0400) == 0400); + + s = symlink_status("."); + v = s.permissions(); + cout << " symlink_status(\".\") permissions are " + << std::oct << (v & 0777) << std::dec << endl; + CHECK((v & 0400) == 0400); + } + + // query_test ----------------------------------------------------------------------// + + void query_test() + { + cout << "query test..." << endl; + + error_code ec; + + CHECK(file_size("no-such-file", ec) == static_cast<boost::uintmax_t>(-1)); + CHECK(ec == errc::no_such_file_or_directory); + + CHECK(status("no-such-file") == file_status(file_not_found, no_perms)); + + CHECK(exists("/")); + CHECK(is_directory("/")); + CHECK(!exists("no-such-file")); + + exists("/", ec); + if (ec) + { + cout << "exists(\"/\", ec) resulted in non-zero ec.value()" << endl; + cout << "ec value: " << ec.value() << ", message: "<< ec.message() << endl; + } + CHECK(!ec); + + CHECK(exists("/")); + CHECK(is_directory("/")); + CHECK(!is_regular_file("/")); + CHECK(!boost::filesystem::is_empty("/")); + CHECK(!is_other("/")); + } + + // directory_iterator_test -----------------------------------------------// + + void directory_iterator_test() + { + cout << "directory_iterator_test..." << endl; + + directory_iterator end; + + directory_iterator it("."); + + CHECK(!it->path().empty()); + + if (is_regular_file(it->status())) + { + CHECK(is_regular_file(it->symlink_status())); + CHECK(!is_directory(it->status())); + CHECK(!is_symlink(it->status())); + CHECK(!is_directory(it->symlink_status())); + CHECK(!is_symlink(it->symlink_status())); + } + else + { + CHECK(is_directory(it->status())); + CHECK(is_directory(it->symlink_status())); + CHECK(!is_regular_file(it->status())); + CHECK(!is_regular_file(it->symlink_status())); + CHECK(!is_symlink(it->status())); + CHECK(!is_symlink(it->symlink_status())); + } + + for (; it != end; ++it) + { +// cout << " " << it->path().string() << "\n"; + } + + cout << "directory_iterator_test complete" << endl; + } + + // operations_test -------------------------------------------------------// + + void operations_test() + { + cout << "operations test..." << endl; + + error_code ec; + + CHECK(!create_directory("/", ec)); + + CHECK(!boost::filesystem::remove("no-such-file-or-directory")); + CHECK(!remove_all("no-such-file-or-directory")); + + space_info info = space("/"); + + CHECK(info.available <= info.capacity); + + CHECK(equivalent("/", "/")); + CHECK(!equivalent("/", ".")); + + std::time_t ft = last_write_time("."); + ft = -1; + last_write_time(".", ft, ec); + } + + // directory_entry_test ------------------------------------------------------------// + + void directory_entry_test() + { + cout << "directory_entry test..." << endl; + + directory_entry de("foo.bar", + file_status(regular_file, owner_all), file_status(directory_file, group_all)); + + CHECK(de.path() == "foo.bar"); + CHECK(de.status() == file_status(regular_file, owner_all)); + CHECK(de.symlink_status() == file_status(directory_file, group_all)); + CHECK(de < directory_entry("goo.bar")); + CHECK(de == directory_entry("foo.bar")); + CHECK(de != directory_entry("goo.bar")); + de.replace_filename("bar.foo"); + CHECK(de.path() == "bar.foo"); + } + + // directory_entry_overload_test ---------------------------------------------------// + + void directory_entry_overload_test() + { + cout << "directory_entry overload test..." << endl; + + directory_iterator it("."); + path p(*it); + } + + // error_handling_test -------------------------------------------------------------// + + void error_handling_test() + { + cout << "error handling test..." << endl; + + bool threw(false); + try + { + file_size("no-such-file"); + } + catch (const boost::filesystem::filesystem_error & ex) + { + threw = true; + cout << "\nas expected, attempt to get size of non-existent file threw a filesystem_error\n" + "what() returns " << ex.what() << "\n"; + } + catch (...) + { + cout << "\nunexpected exception type caught" << endl; + } + + CHECK(threw); + + error_code ec; + CHECK(!create_directory("/", ec)); + } + +} // unnamed namespace + +//--------------------------------------------------------------------------------------// +// // +// main // +// // +//--------------------------------------------------------------------------------------// + +int cpp_main(int, char*[]) +{ +// document state of critical macros +#ifdef BOOST_POSIX_API + cout << "BOOST_POSIX_API is defined\n"; +#endif +#ifdef BOOST_WINDOWS_API + cout << "BOOST_WINDOWS_API is defined\n"; +#endif + cout << "BOOST_FILESYSTEM_DECL" << BOOST_STRINGIZE(=BOOST_FILESYSTEM_DECL) << "\n"; + cout << "BOOST_SYMBOL_VISIBLE" << BOOST_STRINGIZE(=BOOST_SYMBOL_VISIBLE) << "\n"; + + cout << "current_path() is " << current_path().string() << endl; + + file_status_test(); + query_test(); + directory_iterator_test(); + operations_test(); + directory_entry_test(); + directory_entry_overload_test(); + error_handling_test(); + + cout << unique_path() << endl; + cout << unique_path("foo-%%%%%-%%%%%-bar") << endl; + + return ::boost::report_errors(); +} diff --git a/libs/filesystem/v3/test/path_test.cpp b/libs/filesystem/v3/test/path_test.cpp new file mode 100644 index 0000000000..c3e64a73c3 --- /dev/null +++ b/libs/filesystem/v3/test/path_test.cpp @@ -0,0 +1,1811 @@ +// path_test program -----------------------------------------------------------------// + +// Copyright Beman Dawes 2002, 2008 +// Copyright Vladimir Prus 2002 + +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/filesystem + +// basic_path's stem(), extension(), and replace_extension() tests are based +// on basename(), extension(), and change_extension() tests from the original +// convenience_test.cpp by Vladimir Prus. + +//--------------------------------------------------------------------------------------// +// // +// Caution // +// // +// The class path relational operators (==, !=, <, etc.) on Windows treat slash and // +// backslash as equal. Thus any tests on Windows where the difference between slash // +// and backslash is significant should compare strings rather than paths. // +// // +// BOOST_TEST(path == path) // '\\' and '/' are equal // +// BOOST_TEST(path == convertable to string) // '\\' and '/' are equal // +// PATH_TEST_EQ(path, path) // '\\' and '/' are equal // +// // +// BOOST_TEST(path.string() == path.string()) // '\\' and '/' are not equal // +// BOOST_TEST(path.string() == // +// convertable to string) // '\\' and '/' are not equal // +// PATH_TEST_EQ(path.string(), // +// convertable to string) // '\\' and '/' are not equal // +// // +// The last of these is often what is needed, so the PATH_TEST_EQ macro is provided. // +// It converts its first argument to a path, and then performs a .string() on it, // +// eliminating much boilerplate .string() or even path(...).string() code. // +// // +// PATH_TEST_EQ(path, convertable to string) // '\\' and '/' are not equal // +// // +//--------------------------------------------------------------------------------------// + +#define BOOST_FILESYSTEM_VERSION 3 + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/config/warning_disable.hpp> + +// See deprecated_test for tests of deprecated features +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +# define BOOST_FILESYSTEM_NO_DEPRECATED +#endif +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/operations.hpp> +#include <boost/utility.hpp> +#include <iostream> +#include <sstream> +#include <string> +#include <vector> +#include <cstring> +#include <cassert> + +namespace fs = boost::filesystem; +using boost::filesystem::path; + +#include <boost/detail/lightweight_test.hpp> +#include <boost/detail/lightweight_main.hpp> + +#ifdef BOOST_WINDOWS_API +# define BOOST_DIR_SEP "\\" +#else +# define BOOST_DIR_SEP "/" +#endif + +#define PATH_TEST_EQ(a, b) check(a, b, __FILE__, __LINE__) + +namespace +{ + std::string platform(BOOST_PLATFORM); + + void check(const fs::path & source, + const std::string & expected, const char* file, int line) + { + if (source.string() == expected) + return; + + std::cout << file + << '(' << line << "): source: \"" << source.string() + << "\" != expected: \"" << expected + << "\"" << std::endl; + + ++::boost::detail::test_errors(); + } + + path p1("fe/fi/fo/fum"); + path p2(p1); + path p3; + path p4("foobar"); + path p5; + + // exception_tests -----------------------------------------------------------------// + + void exception_tests() + { + std::cout << "exception_tests..." << std::endl; + const std::string str_1("string-1"); + boost::system::error_code ec(12345, boost::system::system_category()); + try { throw fs::filesystem_error(str_1, ec); } + catch (const fs::filesystem_error & ex) + { + //std::cout << ex.what() << "*" << std::endl; + //BOOST_TEST(std::strcmp(ex.what(), + // "string-1: Unknown error") == 0); + BOOST_TEST(ex.code() == ec); + } + + try { throw fs::filesystem_error(str_1, "p1", "p2", ec); } + catch (const fs::filesystem_error & ex) + { + //std::cout << ex.what() << "*" << std::endl; + //BOOST_TEST(std::strcmp(ex.what(), + // "string-1: Unknown error: \"p1\", \"p2\"") == 0); + BOOST_TEST(ex.code() == ec); + BOOST_TEST(ex.path1() == "p1"); + BOOST_TEST(ex.path2() == "p2"); + } + } + + // overload_tests ------------------------------------------------------------------// + + // These verify various overloads don't cause compiler errors + // They pre-date operations_unit_test.cpp + + void overload_tests() + { + std::cout << "overload_tests..." << std::endl; + + fs::exists(p1); + fs::exists("foo"); + fs::exists(std::string("foo")); + + fs::exists(p1 / path("foo")); + fs::exists(p1 / "foo"); + fs::exists(p1 / std::string("foo")); + + fs::exists("foo" / p1); + fs::exists(std::string("foo") / p1); + + p4 /= path("foo"); + p4 /= "foo"; + p4 /= std::string("foo"); + } + + // iterator_tests ------------------------------------------------------------------// + + void iterator_tests() + { + std::cout << "iterator_tests..." << std::endl; + + path itr_ck = ""; + path::const_iterator itr = itr_ck.begin(); + BOOST_TEST(itr == itr_ck.end()); + + itr_ck = "/"; + itr = itr_ck.begin(); + BOOST_TEST(itr->string() == "/"); + BOOST_TEST(++itr == itr_ck.end()); + BOOST_TEST((--itr)->string() == "/"); + + itr_ck = "foo"; + BOOST_TEST(*itr_ck.begin() == std::string("foo")); + BOOST_TEST(boost::next(itr_ck.begin()) == itr_ck.end()); + BOOST_TEST(*boost::prior(itr_ck.end()) == std::string("foo")); + BOOST_TEST(boost::prior(itr_ck.end()) == itr_ck.begin()); + + itr_ck = path("/foo"); + BOOST_TEST((itr_ck.begin())->string() == "/"); + BOOST_TEST(*boost::next(itr_ck.begin()) == std::string("foo")); + BOOST_TEST(boost::next(boost::next(itr_ck.begin())) == itr_ck.end()); + BOOST_TEST(boost::next(itr_ck.begin()) == boost::prior(itr_ck.end())); + BOOST_TEST(*boost::prior(itr_ck.end()) == std::string("foo")); + BOOST_TEST(*boost::prior(boost::prior(itr_ck.end())) == std::string("/")); + BOOST_TEST(boost::prior(boost::prior(itr_ck.end())) == itr_ck.begin()); + + itr_ck = "/foo/bar"; + itr = itr_ck.begin(); + BOOST_TEST(itr->string() == "/"); + BOOST_TEST(*++itr == std::string("foo")); + BOOST_TEST(*++itr == std::string("bar")); + BOOST_TEST(++itr == itr_ck.end()); + PATH_TEST_EQ(*--itr, "bar"); + PATH_TEST_EQ(*--itr, "foo"); + PATH_TEST_EQ(*--itr, "/"); + + itr_ck = "../f"; // previously failed due to short name bug + itr = itr_ck.begin(); + PATH_TEST_EQ(itr->string(), ".."); + PATH_TEST_EQ(*++itr, "f"); + BOOST_TEST(++itr == itr_ck.end()); + PATH_TEST_EQ(*--itr, "f"); + PATH_TEST_EQ(*--itr, ".."); + + // POSIX says treat "/foo/bar/" as "/foo/bar/." + itr_ck = "/foo/bar/"; + itr = itr_ck.begin(); + PATH_TEST_EQ(itr->string(), "/"); + PATH_TEST_EQ(*++itr, "foo"); + PATH_TEST_EQ(*++itr, "bar"); + PATH_TEST_EQ(*++itr, "."); + BOOST_TEST(++itr == itr_ck.end()); + PATH_TEST_EQ(*--itr, "."); + PATH_TEST_EQ(*--itr, "bar"); + PATH_TEST_EQ(*--itr, "foo"); + PATH_TEST_EQ(*--itr, "/"); + + // POSIX says treat "/f/b/" as "/f/b/." + itr_ck = "/f/b/"; + itr = itr_ck.begin(); + PATH_TEST_EQ(itr->string(), "/"); + PATH_TEST_EQ(*++itr, "f"); + PATH_TEST_EQ(*++itr, "b"); + PATH_TEST_EQ(*++itr, "."); + BOOST_TEST(++itr == itr_ck.end()); + PATH_TEST_EQ(*--itr, "."); + PATH_TEST_EQ(*--itr, "b"); + PATH_TEST_EQ(*--itr, "f"); + PATH_TEST_EQ(*--itr, "/"); + + itr_ck = "//net"; + itr = itr_ck.begin(); + // two leading slashes are permitted by POSIX (as implementation defined), + // while for Windows it is always well defined (as a network name) + PATH_TEST_EQ(itr->string(), "//net"); + BOOST_TEST(++itr == itr_ck.end()); + PATH_TEST_EQ(*--itr, "//net"); + + itr_ck = "//net/"; + itr = itr_ck.begin(); + PATH_TEST_EQ(itr->string(), "//net"); + PATH_TEST_EQ(*++itr, "/"); + BOOST_TEST(++itr == itr_ck.end()); + PATH_TEST_EQ(*--itr, "/"); + PATH_TEST_EQ(*--itr, "//net"); + + itr_ck = "//foo///bar///"; + itr = itr_ck.begin(); + PATH_TEST_EQ(itr->string(), "//foo"); + PATH_TEST_EQ(*++itr, "/"); + PATH_TEST_EQ(*++itr, "bar"); + PATH_TEST_EQ(*++itr, "."); + BOOST_TEST(++itr == itr_ck.end()); + PATH_TEST_EQ(*--itr, "."); + PATH_TEST_EQ(*--itr, "bar"); + PATH_TEST_EQ(*--itr, "/"); + PATH_TEST_EQ(*--itr, "//foo"); + + itr_ck = "///foo///bar///"; + itr = itr_ck.begin(); + // three or more leading slashes are to be treated as a single slash + PATH_TEST_EQ(itr->string(), "/"); + PATH_TEST_EQ(*++itr, "foo"); + PATH_TEST_EQ(*++itr, "bar"); + PATH_TEST_EQ(*++itr, "."); + BOOST_TEST(++itr == itr_ck.end()); + PATH_TEST_EQ(*--itr, "."); + PATH_TEST_EQ(*--itr, "bar"); + PATH_TEST_EQ(*--itr, "foo"); + PATH_TEST_EQ(*--itr, "/"); + + if (platform == "Windows") + { + itr_ck = "c:/"; + itr = itr_ck.begin(); + PATH_TEST_EQ(itr->string(), "c:"); + PATH_TEST_EQ(*++itr, std::string("/")); + BOOST_TEST(++itr == itr_ck.end()); + PATH_TEST_EQ(*--itr, "/"); + PATH_TEST_EQ(*--itr, "c:"); + + itr_ck = "c:\\"; + itr = itr_ck.begin(); + PATH_TEST_EQ(itr->string(), "c:"); + PATH_TEST_EQ(*++itr, "/"); // test that iteration returns generic format + BOOST_TEST(++itr == itr_ck.end()); + PATH_TEST_EQ(*--itr, "/"); // test that iteration returns generic format + PATH_TEST_EQ(*--itr, "c:"); + + itr_ck = "c:/foo"; + itr = itr_ck.begin(); + BOOST_TEST(*itr == std::string("c:")); + BOOST_TEST(*++itr == std::string("/")); + BOOST_TEST(*++itr == std::string("foo")); + BOOST_TEST(++itr == itr_ck.end()); + BOOST_TEST(*--itr == std::string("foo")); + BOOST_TEST((--itr)->string() == "/"); + BOOST_TEST(*--itr == std::string("c:")); + + itr_ck = "c:\\foo"; + itr = itr_ck.begin(); + BOOST_TEST(*itr == std::string("c:")); + BOOST_TEST(*++itr == std::string("\\")); + BOOST_TEST(*++itr == std::string("foo")); + BOOST_TEST(++itr == itr_ck.end()); + BOOST_TEST(*--itr == std::string("foo")); + BOOST_TEST(*--itr == std::string("\\")); + BOOST_TEST(*--itr == std::string("c:")); + + itr_ck = "\\\\\\foo\\\\\\bar\\\\\\"; + itr = itr_ck.begin(); + // three or more leading slashes are to be treated as a single slash + PATH_TEST_EQ(itr->string(), "/"); + PATH_TEST_EQ(*++itr, "foo"); + PATH_TEST_EQ(*++itr, "bar"); + PATH_TEST_EQ(*++itr, "."); + BOOST_TEST(++itr == itr_ck.end()); + PATH_TEST_EQ(*--itr, "."); + PATH_TEST_EQ(*--itr, "bar"); + PATH_TEST_EQ(*--itr, "foo"); + PATH_TEST_EQ(*--itr, "/"); + + itr_ck = "c:foo"; + itr = itr_ck.begin(); + BOOST_TEST(*itr == std::string("c:")); + BOOST_TEST(*++itr == std::string("foo")); + BOOST_TEST(++itr == itr_ck.end()); + BOOST_TEST(*--itr == std::string("foo")); + BOOST_TEST(*--itr == std::string("c:")); + + itr_ck = "c:foo/"; + itr = itr_ck.begin(); + BOOST_TEST(*itr == std::string("c:")); + BOOST_TEST(*++itr == std::string("foo")); + BOOST_TEST(*++itr == std::string(".")); + BOOST_TEST(++itr == itr_ck.end()); + BOOST_TEST(*--itr == std::string(".")); + BOOST_TEST(*--itr == std::string("foo")); + BOOST_TEST(*--itr == std::string("c:")); + + itr_ck = path("c:"); + BOOST_TEST(*itr_ck.begin() == std::string("c:")); + BOOST_TEST(next(itr_ck.begin()) == itr_ck.end()); + BOOST_TEST(prior(itr_ck.end()) == itr_ck.begin()); + BOOST_TEST(*prior(itr_ck.end()) == std::string("c:")); + + itr_ck = path("c:/"); + BOOST_TEST(*itr_ck.begin() == std::string("c:")); + BOOST_TEST(*next(itr_ck.begin()) == std::string("/")); + BOOST_TEST(next(next(itr_ck.begin())) == itr_ck.end()); + BOOST_TEST(prior(prior(itr_ck.end())) == itr_ck.begin()); + BOOST_TEST(*prior(itr_ck.end()) == std::string("/")); + BOOST_TEST(*prior(prior(itr_ck.end())) == std::string("c:")); + + itr_ck = path("c:foo"); + BOOST_TEST(*itr_ck.begin() == std::string("c:")); + BOOST_TEST(*next(itr_ck.begin()) == std::string("foo")); + BOOST_TEST(next(next(itr_ck.begin())) == itr_ck.end()); + BOOST_TEST(prior(prior(itr_ck.end())) == itr_ck.begin()); + BOOST_TEST(*prior(itr_ck.end()) == std::string("foo")); + BOOST_TEST(*prior(prior(itr_ck.end())) == std::string("c:")); + + itr_ck = path("c:/foo"); + BOOST_TEST(*itr_ck.begin() == std::string("c:")); + BOOST_TEST(*next(itr_ck.begin()) == std::string("/")); + BOOST_TEST(*next(next(itr_ck.begin())) == std::string("foo")); + BOOST_TEST(next(next(next(itr_ck.begin()))) == itr_ck.end()); + BOOST_TEST(prior(prior(prior(itr_ck.end()))) == itr_ck.begin()); + BOOST_TEST(*prior(itr_ck.end()) == std::string("foo")); + BOOST_TEST(*prior(prior(itr_ck.end())) == std::string("/")); + BOOST_TEST(*prior(prior(prior(itr_ck.end()))) == std::string("c:")); + + itr_ck = path("//net"); + BOOST_TEST(*itr_ck.begin() == std::string("//net")); + BOOST_TEST(next(itr_ck.begin()) == itr_ck.end()); + BOOST_TEST(prior(itr_ck.end()) == itr_ck.begin()); + BOOST_TEST(*prior(itr_ck.end()) == std::string("//net")); + + itr_ck = path("//net/"); + PATH_TEST_EQ(itr_ck.begin()->string(), "//net"); + PATH_TEST_EQ(next(itr_ck.begin())->string(), "/"); + BOOST_TEST(next(next(itr_ck.begin())) == itr_ck.end()); + BOOST_TEST(prior(prior(itr_ck.end())) == itr_ck.begin()); + PATH_TEST_EQ(prior(itr_ck.end())->string(), "/"); + PATH_TEST_EQ(prior(prior(itr_ck.end()))->string(), "//net"); + + itr_ck = path("//net/foo"); + BOOST_TEST(*itr_ck.begin() == std::string("//net")); + BOOST_TEST(*next(itr_ck.begin()) == std::string("/")); + BOOST_TEST(*next(next(itr_ck.begin())) == std::string("foo")); + BOOST_TEST(next(next(next(itr_ck.begin()))) == itr_ck.end()); + BOOST_TEST(prior(prior(prior(itr_ck.end()))) == itr_ck.begin()); + BOOST_TEST(*prior(itr_ck.end()) == std::string("foo")); + BOOST_TEST(*prior(prior(itr_ck.end())) == std::string("/")); + BOOST_TEST(*prior(prior(prior(itr_ck.end()))) == std::string("//net")); + + itr_ck = path("prn:"); + BOOST_TEST(*itr_ck.begin() == std::string("prn:")); + BOOST_TEST(next(itr_ck.begin()) == itr_ck.end()); + BOOST_TEST(prior(itr_ck.end()) == itr_ck.begin()); + BOOST_TEST(*prior(itr_ck.end()) == std::string("prn:")); + } + else + { + itr_ck = "///"; + itr = itr_ck.begin(); + PATH_TEST_EQ(itr->string(), "/"); + BOOST_TEST(++itr == itr_ck.end()); + } + } + + // non_member_tests ----------------------------------------------------------------// + + void non_member_tests() + { + std::cout << "non_member_tests..." << std::endl; + + // test non-member functions, particularly operator overloads + + path e, e2; + std::string es, es2; + char ecs[] = ""; + char ecs2[] = ""; + + char acs[] = "a"; + std::string as(acs); + path a(as); + + char acs2[] = "a"; + std::string as2(acs2); + path a2(as2); + + char bcs[] = "b"; + std::string bs(bcs); + path b(bs); + + // swap + a.swap(b); + BOOST_TEST(a.string() == "b"); + BOOST_TEST(b.string() == "a"); + fs::swap(a, b); + BOOST_TEST(a.string() == "a"); + BOOST_TEST(b.string() == "b"); + + // probe operator / + PATH_TEST_EQ(path("") / ".", "."); + PATH_TEST_EQ(path("") / "..", ".."); + if (platform == "Windows") + { + BOOST_TEST(path("foo\\bar") == "foo/bar"); + BOOST_TEST((b / a).native() == path("b\\a").native()); + BOOST_TEST((bs / a).native() == path("b\\a").native()); + BOOST_TEST((bcs / a).native() == path("b\\a").native()); + BOOST_TEST((b / as).native() == path("b\\a").native()); + BOOST_TEST((b / acs).native() == path("b\\a").native()); + PATH_TEST_EQ(path("a") / "b", "a\\b"); + PATH_TEST_EQ(path("..") / "", ".."); + PATH_TEST_EQ(path("foo") / path("bar"), "foo\\bar"); // path arg + PATH_TEST_EQ(path("foo") / "bar", "foo\\bar"); // const char* arg + PATH_TEST_EQ(path("foo") / path("woo/bar").filename(), "foo\\bar"); // const std::string & arg + PATH_TEST_EQ("foo" / path("bar"), "foo\\bar"); + PATH_TEST_EQ(path("..") / ".." , "..\\.."); + PATH_TEST_EQ(path("/") / ".." , "/.."); + PATH_TEST_EQ(path("/..") / ".." , "/..\\.."); + PATH_TEST_EQ(path("..") / "foo" , "..\\foo"); + PATH_TEST_EQ(path("foo") / ".." , "foo\\.."); + PATH_TEST_EQ(path("..") / "f" , "..\\f"); + PATH_TEST_EQ(path("/..") / "f" , "/..\\f"); + PATH_TEST_EQ(path("f") / ".." , "f\\.."); + PATH_TEST_EQ(path("foo") / ".." / ".." , "foo\\..\\.."); + PATH_TEST_EQ(path("foo") / ".." / ".." / ".." , "foo\\..\\..\\.."); + PATH_TEST_EQ(path("f") / ".." / "b" , "f\\..\\b"); + PATH_TEST_EQ(path("foo") / ".." / "bar" , "foo\\..\\bar"); + PATH_TEST_EQ(path("foo") / "bar" / ".." , "foo\\bar\\.."); + PATH_TEST_EQ(path("foo") / "bar" / ".." / "..", "foo\\bar\\..\\.."); + PATH_TEST_EQ(path("foo") / "bar" / ".." / "blah", "foo\\bar\\..\\blah"); + PATH_TEST_EQ(path("f") / "b" / ".." , "f\\b\\.."); + PATH_TEST_EQ(path("f") / "b" / ".." / "a", "f\\b\\..\\a"); + PATH_TEST_EQ(path("foo") / "bar" / "blah" / ".." / "..", "foo\\bar\\blah\\..\\.."); + PATH_TEST_EQ(path("foo") / "bar" / "blah" / ".." / ".." / "bletch", "foo\\bar\\blah\\..\\..\\bletch"); + + PATH_TEST_EQ(path(".") / "foo", ".\\foo"); + PATH_TEST_EQ(path(".") / "..", ".\\.."); + PATH_TEST_EQ(path("foo") / ".", "foo\\."); + PATH_TEST_EQ(path("..") / ".", "..\\."); + PATH_TEST_EQ(path(".") / ".", ".\\."); + PATH_TEST_EQ(path(".") / "." / ".", ".\\.\\."); + PATH_TEST_EQ(path(".") / "foo" / ".", ".\\foo\\."); + PATH_TEST_EQ(path("foo") / "." / "bar", "foo\\.\\bar"); + PATH_TEST_EQ(path("foo") / "." / ".", "foo\\.\\."); + PATH_TEST_EQ(path("foo") / "." / "..", "foo\\.\\.."); + PATH_TEST_EQ(path(".") / "." / "..", ".\\.\\.."); + PATH_TEST_EQ(path(".") / ".." / ".", ".\\..\\."); + PATH_TEST_EQ(path("..") / "." / ".", "..\\.\\."); + } + else // POSIX + { + PATH_TEST_EQ(b / a, "b/a"); + PATH_TEST_EQ(bs / a, "b/a"); + PATH_TEST_EQ(bcs / a, "b/a"); + PATH_TEST_EQ(b / as, "b/a"); + PATH_TEST_EQ(b / acs, "b/a"); + PATH_TEST_EQ(path("a") / "b", "a/b"); + PATH_TEST_EQ(path("..") / "", ".."); + PATH_TEST_EQ(path("") / "..", ".."); + PATH_TEST_EQ(path("foo") / path("bar"), "foo/bar"); // path arg + PATH_TEST_EQ(path("foo") / "bar", "foo/bar"); // const char* arg + PATH_TEST_EQ(path("foo") / path("woo/bar").filename(), "foo/bar"); // const std::string & arg + PATH_TEST_EQ("foo" / path("bar"), "foo/bar"); + PATH_TEST_EQ(path("..") / ".." , "../.."); + PATH_TEST_EQ(path("/") / ".." , "/.."); + PATH_TEST_EQ(path("/..") / ".." , "/../.."); + PATH_TEST_EQ(path("..") / "foo" , "../foo"); + PATH_TEST_EQ(path("foo") / ".." , "foo/.."); + PATH_TEST_EQ(path("..") / "f" , "../f"); + PATH_TEST_EQ(path("/..") / "f" , "/../f"); + PATH_TEST_EQ(path("f") / ".." , "f/.."); + PATH_TEST_EQ(path("foo") / ".." / ".." , "foo/../.."); + PATH_TEST_EQ(path("foo") / ".." / ".." / ".." , "foo/../../.."); + PATH_TEST_EQ(path("f") / ".." / "b" , "f/../b"); + PATH_TEST_EQ(path("foo") / ".." / "bar" , "foo/../bar"); + PATH_TEST_EQ(path("foo") / "bar" / ".." , "foo/bar/.."); + PATH_TEST_EQ(path("foo") / "bar" / ".." / "..", "foo/bar/../.."); + PATH_TEST_EQ(path("foo") / "bar" / ".." / "blah", "foo/bar/../blah"); + PATH_TEST_EQ(path("f") / "b" / ".." , "f/b/.."); + PATH_TEST_EQ(path("f") / "b" / ".." / "a", "f/b/../a"); + PATH_TEST_EQ(path("foo") / "bar" / "blah" / ".." / "..", "foo/bar/blah/../.."); + PATH_TEST_EQ(path("foo") / "bar" / "blah" / ".." / ".." / "bletch", "foo/bar/blah/../../bletch"); + + PATH_TEST_EQ(path(".") / "foo", "./foo"); + PATH_TEST_EQ(path(".") / "..", "./.."); + PATH_TEST_EQ(path("foo") / ".", "foo/."); + PATH_TEST_EQ(path("..") / ".", "../."); + PATH_TEST_EQ(path(".") / ".", "./."); + PATH_TEST_EQ(path(".") / "." / ".", "././."); + PATH_TEST_EQ(path(".") / "foo" / ".", "./foo/."); + PATH_TEST_EQ(path("foo") / "." / "bar", "foo/./bar"); + PATH_TEST_EQ(path("foo") / "." / ".", "foo/./."); + PATH_TEST_EQ(path("foo") / "." / "..", "foo/./.."); + PATH_TEST_EQ(path(".") / "." / "..", "././.."); + PATH_TEST_EQ(path(".") / ".." / ".", "./../."); + PATH_TEST_EQ(path("..") / "." / ".", ".././."); + } + + // probe operator < + BOOST_TEST(!(e < e2)); + BOOST_TEST(!(es < e2)); + BOOST_TEST(!(ecs < e2)); + BOOST_TEST(!(e < es2)); + BOOST_TEST(!(e < ecs2)); + + BOOST_TEST(e < a); + BOOST_TEST(es < a); + BOOST_TEST(ecs < a); + BOOST_TEST(e < as); + BOOST_TEST(e < acs); + + BOOST_TEST(a < b); + BOOST_TEST(as < b); + BOOST_TEST(acs < b); + BOOST_TEST(a < bs); + BOOST_TEST(a < bcs); + + BOOST_TEST(!(a < a2)); + BOOST_TEST(!(as < a2)); + BOOST_TEST(!(acs < a2)); + BOOST_TEST(!(a < as2)); + BOOST_TEST(!(a < acs2)); + + // make sure basic_path overloads don't conflict with std::string overloads + + BOOST_TEST(!(as < as)); + BOOST_TEST(!(as < acs)); + BOOST_TEST(!(acs < as)); + + // reality check character set is as expected + BOOST_TEST(std::string("a.b") < std::string("a/b")); + // verify compare is actually lexicographical + BOOST_TEST(path("a/b") < path("a.b")); + + // make sure the derivative operators also work + + BOOST_TEST(b > a); + BOOST_TEST(b > as); + BOOST_TEST(b > acs); + BOOST_TEST(bs > a); + BOOST_TEST(bcs > a); + + BOOST_TEST(!(a2 > a)); + BOOST_TEST(!(a2 > as)); + BOOST_TEST(!(a2 > acs)); + BOOST_TEST(!(as2 > a)); + BOOST_TEST(!(acs2 > a)); + + BOOST_TEST(a <= b); + BOOST_TEST(as <= b); + BOOST_TEST(acs <= b); + BOOST_TEST(a <= bs); + BOOST_TEST(a <= bcs); + + BOOST_TEST(a <= a2); + BOOST_TEST(as <= a2); + BOOST_TEST(acs <= a2); + BOOST_TEST(a <= as2); + BOOST_TEST(a <= acs2); + + BOOST_TEST(b >= a); + BOOST_TEST(bs >= a); + BOOST_TEST(bcs >= a); + BOOST_TEST(b >= as); + BOOST_TEST(b >= acs); + + BOOST_TEST(a2 >= a); + BOOST_TEST(as2 >= a); + BOOST_TEST(acs2 >= a); + BOOST_TEST(a2 >= as); + BOOST_TEST(a2 >= acs); + + // operator == and != are implemented separately, so test separately + + path p1("fe/fi/fo/fum"); + path p2(p1); + path p3("fe/fi/fo/fumm"); + BOOST_TEST(p1.string() != p3.string()); + + // check each overload + BOOST_TEST(p1 != p3); + BOOST_TEST(p1 != p3.string()); + BOOST_TEST(p1 != p3.string().c_str()); + BOOST_TEST(p1.string() != p3); + BOOST_TEST(p1.string().c_str() != p3); + + p3 = p2; + BOOST_TEST(p1.string() == p3.string()); + + // check each overload + BOOST_TEST(p1 == p3); + BOOST_TEST(p1 == p3.string()); + BOOST_TEST(p1 == p3.string().c_str()); + BOOST_TEST(p1.string() == p3); + BOOST_TEST(p1.string().c_str() == p3); + + if (platform == "Windows") + { + std::cout << "Windows relational tests..." << std::endl; + path p10 ("c:\\file"); + path p11 ("c:/file"); + // check each overload + BOOST_TEST(p10.generic_string() == p11.generic_string()); + BOOST_TEST(p10 == p11); + BOOST_TEST(p10 == p11.string()); + BOOST_TEST(p10 == p11.string().c_str()); + BOOST_TEST(p10.string() == p11); + BOOST_TEST(p10.string().c_str() == p11); + BOOST_TEST(p10 == L"c:\\file"); + BOOST_TEST(p10 == L"c:/file"); + BOOST_TEST(p11 == L"c:\\file"); + BOOST_TEST(p11 == L"c:/file"); + BOOST_TEST(L"c:\\file" == p10); + BOOST_TEST(L"c:/file" == p10); + BOOST_TEST(L"c:\\file" == p11); + BOOST_TEST(L"c:/file" == p11); + + BOOST_TEST(!(p10.generic_string() != p11.generic_string())); + BOOST_TEST(!(p10 != p11)); + BOOST_TEST(!(p10 != p11.string())); + BOOST_TEST(!(p10 != p11.string().c_str())); + BOOST_TEST(!(p10.string() != p11)); + BOOST_TEST(!(p10.string().c_str() != p11)); + BOOST_TEST(!(p10 != L"c:\\file")); + BOOST_TEST(!(p10 != L"c:/file")); + BOOST_TEST(!(p11 != L"c:\\file")); + BOOST_TEST(!(p11 != L"c:/file")); + BOOST_TEST(!(L"c:\\file" != p10)); + BOOST_TEST(!(L"c:/file" != p10)); + BOOST_TEST(!(L"c:\\file" != p11)); + BOOST_TEST(!(L"c:/file" != p11)); + + BOOST_TEST(!(p10.string() < p11.string())); + BOOST_TEST(!(p10 < p11)); + BOOST_TEST(!(p10 < p11.string())); + BOOST_TEST(!(p10 < p11.string().c_str())); + BOOST_TEST(!(p10.string() < p11)); + BOOST_TEST(!(p10.string().c_str() < p11)); + BOOST_TEST(!(p10 < L"c:\\file")); + BOOST_TEST(!(p10 < L"c:/file")); + BOOST_TEST(!(p11 < L"c:\\file")); + BOOST_TEST(!(p11 < L"c:/file")); + BOOST_TEST(!(L"c:\\file" < p10)); + BOOST_TEST(!(L"c:/file" < p10)); + BOOST_TEST(!(L"c:\\file" < p11)); + BOOST_TEST(!(L"c:/file" < p11)); + + BOOST_TEST(!(p10.generic_string() > p11.generic_string())); + BOOST_TEST(!(p10 > p11)); + BOOST_TEST(!(p10 > p11.string())); + BOOST_TEST(!(p10 > p11.string().c_str())); + BOOST_TEST(!(p10.string() > p11)); + BOOST_TEST(!(p10.string().c_str() > p11)); + BOOST_TEST(!(p10 > L"c:\\file")); + BOOST_TEST(!(p10 > L"c:/file")); + BOOST_TEST(!(p11 > L"c:\\file")); + BOOST_TEST(!(p11 > L"c:/file")); + BOOST_TEST(!(L"c:\\file" > p10)); + BOOST_TEST(!(L"c:/file" > p10)); + BOOST_TEST(!(L"c:\\file" > p11)); + BOOST_TEST(!(L"c:/file" > p11)); + } + } + + // query_and_decomposition_tests ---------------------------------------------------// + // + // remove_filename() is also tested here, because its specification depends on + // a decomposition function. + + void query_and_decomposition_tests() + { + std::cout << "query_and_decomposition_tests..." << std::endl; + + // stem() tests not otherwise covered + BOOST_TEST(path("b").stem() == "b"); + BOOST_TEST(path("a/b.txt").stem() == "b"); + BOOST_TEST(path("a/b.").stem() == "b"); + BOOST_TEST(path("a.b.c").stem() == "a.b"); + BOOST_TEST(path("a.b.c.").stem() == "a.b.c"); + + // extension() tests not otherwise covered + BOOST_TEST(path("a/b").extension() == ""); + BOOST_TEST(path("a.b/c").extension() == ""); + BOOST_TEST(path("a/b.txt").extension() == ".txt"); + BOOST_TEST(path("a/b.").extension() == "."); + BOOST_TEST(path("a.b.c").extension() == ".c"); + BOOST_TEST(path("a.b.c.").extension() == "."); + BOOST_TEST(path("a/").extension() == ""); + + // main q & d test sequence + path p; + path q; + + p = q = ""; + BOOST_TEST(p.relative_path().string() == ""); + BOOST_TEST(p.parent_path().string() == ""); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == ""); + BOOST_TEST(p.stem() == ""); + BOOST_TEST(p.extension() == ""); + BOOST_TEST(p.root_name() == ""); + BOOST_TEST(p.root_directory() == ""); + BOOST_TEST(p.root_path().string() == ""); + BOOST_TEST(!p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(!p.has_relative_path()); + BOOST_TEST(!p.has_filename()); + BOOST_TEST(!p.has_stem()); + BOOST_TEST(!p.has_extension()); + BOOST_TEST(!p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + p = q = "/"; + BOOST_TEST(p.relative_path().string() == ""); + BOOST_TEST(p.parent_path().string() == ""); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "/"); + BOOST_TEST(p.stem() == "/"); + BOOST_TEST(p.extension() == ""); + BOOST_TEST(p.root_name() == ""); + BOOST_TEST(p.root_directory() == "/"); + BOOST_TEST(p.root_path().string() == "/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(!p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_stem()); + BOOST_TEST(!p.has_extension()); + BOOST_TEST(!p.has_parent_path()); + if (platform == "POSIX") + BOOST_TEST(p.is_absolute()); + else + BOOST_TEST(!p.is_absolute()); + + p = q = "//"; + PATH_TEST_EQ(p.relative_path().string(), ""); + PATH_TEST_EQ(p.parent_path().string(), ""); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.filename(), "//"); + PATH_TEST_EQ(p.stem(), "//"); + PATH_TEST_EQ(p.extension(), ""); + PATH_TEST_EQ(p.root_name(), "//"); + PATH_TEST_EQ(p.root_directory(), ""); + PATH_TEST_EQ(p.root_path().string(), "//"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(!p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_stem()); + BOOST_TEST(!p.has_extension()); + BOOST_TEST(!p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + p = q = "///"; + PATH_TEST_EQ(p.relative_path().string(), ""); + PATH_TEST_EQ(p.parent_path().string(), ""); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.filename(), "/"); + PATH_TEST_EQ(p.stem(), "/"); + PATH_TEST_EQ(p.extension(), ""); + PATH_TEST_EQ(p.root_name(), ""); + PATH_TEST_EQ(p.root_directory(), "/"); + PATH_TEST_EQ(p.root_path().string(), "/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(!p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_stem()); + BOOST_TEST(!p.has_extension()); + BOOST_TEST(!p.has_parent_path()); + if (platform == "POSIX") + BOOST_TEST(p.is_absolute()); + else + BOOST_TEST(!p.is_absolute()); + + p = q = "."; + BOOST_TEST(p.relative_path().string() == "."); + BOOST_TEST(p.parent_path().string() == ""); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "."); + BOOST_TEST(p.stem() == "."); + BOOST_TEST(p.extension() == ""); + BOOST_TEST(p.root_name() == ""); + BOOST_TEST(p.root_directory() == ""); + BOOST_TEST(p.root_path().string() == ""); + BOOST_TEST(!p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_stem()); + BOOST_TEST(!p.has_extension()); + BOOST_TEST(!p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + p = q = ".."; + BOOST_TEST(p.relative_path().string() == ".."); + BOOST_TEST(p.parent_path().string() == ""); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == ".."); + BOOST_TEST(p.stem() == ".."); + BOOST_TEST(p.extension() == ""); + BOOST_TEST(p.root_name() == ""); + BOOST_TEST(p.root_directory() == ""); + BOOST_TEST(p.root_path().string() == ""); + BOOST_TEST(!p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_stem()); + BOOST_TEST(!p.has_extension()); + BOOST_TEST(!p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + p = q = "foo"; + BOOST_TEST(p.relative_path().string() == "foo"); + BOOST_TEST(p.parent_path().string() == ""); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "foo"); + BOOST_TEST(p.stem() == "foo"); + BOOST_TEST(p.extension() == ""); + BOOST_TEST(p.root_name() == ""); + BOOST_TEST(p.root_directory() == ""); + BOOST_TEST(p.root_path().string() == ""); + BOOST_TEST(!p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_stem()); + BOOST_TEST(!p.has_extension()); + BOOST_TEST(!p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + p = q = "/foo"; + PATH_TEST_EQ(p.relative_path().string(), "foo"); + PATH_TEST_EQ(p.parent_path().string(), "/"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.filename(), "foo"); + PATH_TEST_EQ(p.stem(), "foo"); + PATH_TEST_EQ(p.extension(), ""); + PATH_TEST_EQ(p.root_name(), ""); + PATH_TEST_EQ(p.root_directory(), "/"); + PATH_TEST_EQ(p.root_path().string(), "/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_stem()); + BOOST_TEST(!p.has_extension()); + BOOST_TEST(p.has_parent_path()); + if (platform == "POSIX") + BOOST_TEST(p.is_absolute()); + else + BOOST_TEST(!p.is_absolute()); + + p = q = "/foo/"; + PATH_TEST_EQ(p.relative_path().string(), "foo/"); + PATH_TEST_EQ(p.parent_path().string(), "/foo"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.filename(), "."); + PATH_TEST_EQ(p.stem(), "."); + PATH_TEST_EQ(p.extension(), ""); + PATH_TEST_EQ(p.root_name(), ""); + PATH_TEST_EQ(p.root_directory(), "/"); + PATH_TEST_EQ(p.root_path().string(), "/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_stem()); + BOOST_TEST(!p.has_extension()); + BOOST_TEST(p.has_parent_path()); + if (platform == "POSIX") + BOOST_TEST(p.is_absolute()); + else + BOOST_TEST(!p.is_absolute()); + + p = q = "///foo"; + PATH_TEST_EQ(p.relative_path().string(), "foo"); + PATH_TEST_EQ(p.parent_path().string(), "/"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.filename(), "foo"); + PATH_TEST_EQ(p.root_name(), ""); + PATH_TEST_EQ(p.root_directory(), "/"); + PATH_TEST_EQ(p.root_path().string(), "/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + if (platform == "POSIX") + BOOST_TEST(p.is_absolute()); + else + BOOST_TEST(!p.is_absolute()); + + p = q = "foo/bar"; + BOOST_TEST(p.relative_path().string() == "foo/bar"); + BOOST_TEST(p.parent_path().string() == "foo"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "bar"); + BOOST_TEST(p.stem() == "bar"); + BOOST_TEST(p.extension() == ""); + BOOST_TEST(p.root_name() == ""); + BOOST_TEST(p.root_directory() == ""); + BOOST_TEST(p.root_path().string() == ""); + BOOST_TEST(!p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_stem()); + BOOST_TEST(!p.has_extension()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + p = q = "../foo"; + BOOST_TEST(p.relative_path().string() == "../foo"); + BOOST_TEST(p.parent_path().string() == ".."); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "foo"); + BOOST_TEST(p.root_name() == ""); + BOOST_TEST(p.root_directory() == ""); + BOOST_TEST(p.root_path().string() == ""); + BOOST_TEST(!p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + p = q = "..///foo"; + PATH_TEST_EQ(p.relative_path().string(), "..///foo"); + PATH_TEST_EQ(p.parent_path().string(), ".."); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.filename(), "foo"); + PATH_TEST_EQ(p.root_name(), ""); + PATH_TEST_EQ(p.root_directory(), ""); + PATH_TEST_EQ(p.root_path().string(), ""); + BOOST_TEST(!p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + p = q = "/foo/bar"; + BOOST_TEST(p.relative_path().string() == "foo/bar"); + BOOST_TEST(p.parent_path().string() == "/foo"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "bar"); + BOOST_TEST(p.root_name() == ""); + BOOST_TEST(p.root_directory() == "/"); + BOOST_TEST(p.root_path().string() == "/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(!p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + if (platform == "POSIX") + BOOST_TEST(p.is_absolute()); + else + BOOST_TEST(!p.is_absolute()); + + // Both POSIX and Windows allow two leading slashs + // (POSIX meaning is implementation defined) + PATH_TEST_EQ(path("//resource"), "//resource"); + PATH_TEST_EQ(path("//resource/"), "//resource/"); + PATH_TEST_EQ(path("//resource/foo"), "//resource/foo"); + + p = q = path("//net"); + PATH_TEST_EQ(p.string(), "//net"); + PATH_TEST_EQ(p.relative_path().string(), ""); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.parent_path().string(), ""); + PATH_TEST_EQ(p.filename(), "//net"); + PATH_TEST_EQ(p.root_name(), "//net"); + PATH_TEST_EQ(p.root_directory(), ""); + PATH_TEST_EQ(p.root_path().string(), "//net"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(!p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(!p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + p = q = path("//net/"); + BOOST_TEST(p.relative_path().string() == ""); + BOOST_TEST(p.parent_path().string() == "//net"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "/"); + BOOST_TEST(p.root_name() == "//net"); + BOOST_TEST(p.root_directory() == "/"); + BOOST_TEST(p.root_path().string() == "//net/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(!p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(p.is_absolute()); + + p = q = path("//net/foo"); + BOOST_TEST(p.relative_path().string() == "foo"); + BOOST_TEST(p.parent_path().string() == "//net/"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "foo"); + BOOST_TEST(p.root_name() == "//net"); + BOOST_TEST(p.root_directory() == "/"); + BOOST_TEST(p.root_path().string() == "//net/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(p.is_absolute()); + + p = q = path("//net///foo"); + PATH_TEST_EQ(p.relative_path().string(), "foo"); + PATH_TEST_EQ(p.parent_path().string(), "//net/"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.filename(), "foo"); + PATH_TEST_EQ(p.root_name(), "//net"); + PATH_TEST_EQ(p.root_directory(), "/"); + PATH_TEST_EQ(p.root_path().string(), "//net/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(p.is_absolute()); + + if (platform == "Windows") + { + + //p = q = L"\\\\?\\"; + //BOOST_TEST(p.relative_path().string() == ""); + //BOOST_TEST(p.parent_path().string() == ""); + //PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + //BOOST_TEST(p.filename() == ""); + //BOOST_TEST(p.stem() == ""); + //BOOST_TEST(p.extension() == ""); + //BOOST_TEST(p.root_name() == ""); + //BOOST_TEST(p.root_directory() == ""); + //BOOST_TEST(p.root_path().string() == ""); + //BOOST_TEST(!p.has_root_path()); + //BOOST_TEST(!p.has_root_name()); + //BOOST_TEST(!p.has_root_directory()); + //BOOST_TEST(!p.has_relative_path()); + //BOOST_TEST(!p.has_filename()); + //BOOST_TEST(!p.has_stem()); + //BOOST_TEST(!p.has_extension()); + //BOOST_TEST(!p.has_parent_path()); + //BOOST_TEST(!p.is_absolute()); + + p = q = path("c:"); + BOOST_TEST(p.relative_path().string() == ""); + BOOST_TEST(p.parent_path().string() == ""); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "c:"); + BOOST_TEST(p.root_name() == "c:"); + BOOST_TEST(p.root_directory() == ""); + BOOST_TEST(p.root_path().string() == "c:"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(!p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(!p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + //p = q = path(L"\\\\?\\c:"); + //BOOST_TEST(p.relative_path().string() == ""); + //BOOST_TEST(p.parent_path().string() == ""); + //PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + //BOOST_TEST(p.filename() == "c:"); + //BOOST_TEST(p.root_name() == "c:"); + //BOOST_TEST(p.root_directory() == ""); + //BOOST_TEST(p.root_path().string() == "c:"); + //BOOST_TEST(p.has_root_path()); + //BOOST_TEST(p.has_root_name()); + //BOOST_TEST(!p.has_root_directory()); + //BOOST_TEST(!p.has_relative_path()); + //BOOST_TEST(p.has_filename()); + //BOOST_TEST(!p.has_parent_path()); + //BOOST_TEST(!p.is_absolute()); + + p = q = path("c:foo"); + BOOST_TEST(p.relative_path().string() == "foo"); + BOOST_TEST(p.parent_path().string() == "c:"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "foo"); + BOOST_TEST(p.root_name() == "c:"); + BOOST_TEST(p.root_directory() == ""); + BOOST_TEST(p.root_path().string() == "c:"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + //p = q = path(L"\\\\?\\c:foo"); + //BOOST_TEST(p.relative_path().string() == "foo"); + //BOOST_TEST(p.parent_path().string() == "c:"); + //PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + //BOOST_TEST(p.filename() == "foo"); + //BOOST_TEST(p.root_name() == "c:"); + //BOOST_TEST(p.root_directory() == ""); + //BOOST_TEST(p.root_path().string() == "c:"); + //BOOST_TEST(p.has_root_path()); + //BOOST_TEST(p.has_root_name()); + //BOOST_TEST(!p.has_root_directory()); + //BOOST_TEST(p.has_relative_path()); + //BOOST_TEST(p.has_filename()); + //BOOST_TEST(p.has_parent_path()); + //BOOST_TEST(!p.is_absolute()); + + p = q = path("c:/"); + BOOST_TEST(p.relative_path().string() == ""); + BOOST_TEST(p.parent_path().string() == "c:"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "/"); + BOOST_TEST(p.root_name() == "c:"); + BOOST_TEST(p.root_directory() == "/"); + BOOST_TEST(p.root_path().string() == "c:/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(!p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(p.is_absolute()); + + p = q = path("c:.."); + BOOST_TEST(p.relative_path().string() == ".."); + BOOST_TEST(p.parent_path().string() == "c:"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == ".."); + BOOST_TEST(p.root_name() == "c:"); + BOOST_TEST(p.root_directory() == ""); + BOOST_TEST(p.root_path().string() == "c:"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + p = q = path("c:/foo"); + PATH_TEST_EQ(p.relative_path().string(), "foo"); + PATH_TEST_EQ(p.parent_path().string(), "c:/"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.filename(), "foo"); + PATH_TEST_EQ(p.root_name(), "c:"); + PATH_TEST_EQ(p.root_directory(), "/"); + PATH_TEST_EQ(p.root_path().string(), "c:/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(p.is_absolute()); + + p = q = path("c://foo"); + PATH_TEST_EQ(p.relative_path().string(), "foo"); + PATH_TEST_EQ(p.parent_path().string(), "c:/"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.filename(), "foo"); + PATH_TEST_EQ(p.root_name(), "c:"); + PATH_TEST_EQ(p.root_directory(), "/"); + PATH_TEST_EQ(p.root_path().string(), "c:/"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(p.is_absolute()); + + p = q = path("c:\\foo\\bar"); + PATH_TEST_EQ(p.relative_path().string(), "foo\\bar"); + PATH_TEST_EQ(p.parent_path().string(), "c:\\foo"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.filename(), "bar"); + PATH_TEST_EQ(p.root_name(), "c:"); + PATH_TEST_EQ(p.root_directory(), "\\"); + PATH_TEST_EQ(p.root_path().string(), "c:\\"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(p.is_absolute()); + + p = q = path("prn:"); + BOOST_TEST(p.relative_path().string() == ""); + BOOST_TEST(p.parent_path().string() == ""); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + BOOST_TEST(p.filename() == "prn:"); + BOOST_TEST(p.root_name() == "prn:"); + BOOST_TEST(p.root_directory() == ""); + BOOST_TEST(p.root_path().string() == "prn:"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(!p.has_root_directory()); + BOOST_TEST(!p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(!p.has_parent_path()); + BOOST_TEST(!p.is_absolute()); + + p = q = path("\\\\net\\\\\\foo"); + PATH_TEST_EQ(p.relative_path().string(), "foo"); + PATH_TEST_EQ(p.parent_path().string(), "\\\\net\\"); + PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string()); + PATH_TEST_EQ(p.filename(), "foo"); + PATH_TEST_EQ(p.root_name(), "\\\\net"); + PATH_TEST_EQ(p.root_directory(), "\\"); + PATH_TEST_EQ(p.root_path().string(), "\\\\net\\"); + BOOST_TEST(p.has_root_path()); + BOOST_TEST(p.has_root_name()); + BOOST_TEST(p.has_root_directory()); + BOOST_TEST(p.has_relative_path()); + BOOST_TEST(p.has_filename()); + BOOST_TEST(p.has_parent_path()); + BOOST_TEST(p.is_absolute()); + } // Windows + + else + { // POSIX + PATH_TEST_EQ(path("/foo/bar/"), "/foo/bar/"); + PATH_TEST_EQ(path("//foo//bar//"), "//foo//bar//"); + PATH_TEST_EQ(path("///foo///bar///"), "///foo///bar///"); + + p = path("/usr/local/bin:/usr/bin:/bin"); + BOOST_TEST(p.string() == "/usr/local/bin:/usr/bin:/bin"); + } // POSIX + } + + // composition_tests ----------------------------------------------------------------// + + void composition_tests() + { + std::cout << "composition_tests..." << std::endl; + + } + + // construction_tests ---------------------------------------------------------------// + + void construction_tests() + { + std::cout << "construction_tests..." << std::endl; + + PATH_TEST_EQ("", ""); + + PATH_TEST_EQ("foo", "foo"); + PATH_TEST_EQ("f", "f"); + + PATH_TEST_EQ("foo/", "foo/"); + PATH_TEST_EQ("f/", "f/"); + PATH_TEST_EQ("foo/..", "foo/.."); + PATH_TEST_EQ("foo/../", "foo/../"); + PATH_TEST_EQ("foo/bar/../..", "foo/bar/../.."); + PATH_TEST_EQ("foo/bar/../../", "foo/bar/../../"); + PATH_TEST_EQ("/", "/"); + PATH_TEST_EQ("/f", "/f"); + + PATH_TEST_EQ("/foo", "/foo"); + PATH_TEST_EQ("/foo/bar/", "/foo/bar/"); + PATH_TEST_EQ("//foo//bar//", "//foo//bar//"); + PATH_TEST_EQ("///foo///bar///", "///foo///bar///"); + PATH_TEST_EQ("\\/foo\\/bar\\/", "\\/foo\\/bar\\/"); + PATH_TEST_EQ("\\//foo\\//bar\\//", "\\//foo\\//bar\\//"); + + if (platform == "Windows") + { + PATH_TEST_EQ(path("c:") / "foo", "c:foo"); + PATH_TEST_EQ(path("c:") / "/foo", "c:/foo"); + + PATH_TEST_EQ("\\foo\\bar\\", "\\foo\\bar\\"); + PATH_TEST_EQ("\\\\foo\\\\bar\\\\", "\\\\foo\\\\bar\\\\"); + PATH_TEST_EQ("\\\\\\foo\\\\\\bar\\\\\\", "\\\\\\foo\\\\\\bar\\\\\\"); + + PATH_TEST_EQ("\\", "\\"); + PATH_TEST_EQ("\\f", "\\f"); + PATH_TEST_EQ("\\foo", "\\foo"); + PATH_TEST_EQ("foo\\bar", "foo\\bar"); + PATH_TEST_EQ("foo bar", "foo bar"); + PATH_TEST_EQ("c:", "c:"); + PATH_TEST_EQ("c:/", "c:/"); + PATH_TEST_EQ("c:.", "c:."); + PATH_TEST_EQ("c:./foo", "c:./foo"); + PATH_TEST_EQ("c:.\\foo", "c:.\\foo"); + PATH_TEST_EQ("c:..", "c:.."); + PATH_TEST_EQ("c:/.", "c:/."); + PATH_TEST_EQ("c:/..", "c:/.."); + PATH_TEST_EQ("c:/../", "c:/../"); + PATH_TEST_EQ("c:\\..\\", "c:\\..\\"); + PATH_TEST_EQ("c:/../..", "c:/../.."); + PATH_TEST_EQ("c:/../foo", "c:/../foo"); + PATH_TEST_EQ("c:\\..\\foo", "c:\\..\\foo"); + PATH_TEST_EQ("c:../foo", "c:../foo"); + PATH_TEST_EQ("c:..\\foo", "c:..\\foo"); + PATH_TEST_EQ("c:/../../foo", "c:/../../foo"); + PATH_TEST_EQ("c:\\..\\..\\foo", "c:\\..\\..\\foo"); + PATH_TEST_EQ("c:foo/..", "c:foo/.."); + PATH_TEST_EQ("c:/foo/..", "c:/foo/.."); + PATH_TEST_EQ("c:/..foo", "c:/..foo"); + PATH_TEST_EQ("c:foo", "c:foo"); + PATH_TEST_EQ("c:/foo", "c:/foo"); + PATH_TEST_EQ("\\\\netname", "\\\\netname"); + PATH_TEST_EQ("\\\\netname\\", "\\\\netname\\"); + PATH_TEST_EQ("\\\\netname\\foo", "\\\\netname\\foo"); + PATH_TEST_EQ("c:/foo", "c:/foo"); + PATH_TEST_EQ("prn:", "prn:"); + } + else + { + } + + PATH_TEST_EQ("foo/bar", "foo/bar"); + PATH_TEST_EQ("a/b", "a/b"); // probe for length effects + PATH_TEST_EQ("..", ".."); + PATH_TEST_EQ("../..", "../.."); + PATH_TEST_EQ("/..", "/.."); + PATH_TEST_EQ("/../..", "/../.."); + PATH_TEST_EQ("../foo", "../foo"); + PATH_TEST_EQ("foo/..", "foo/.."); + PATH_TEST_EQ("foo/..bar", "foo/..bar"); + PATH_TEST_EQ("../f", "../f"); + PATH_TEST_EQ("/../f", "/../f"); + PATH_TEST_EQ("f/..", "f/.."); + PATH_TEST_EQ("foo/../..", "foo/../.."); + PATH_TEST_EQ("foo/../../..", "foo/../../.."); + PATH_TEST_EQ("foo/../bar", "foo/../bar"); + PATH_TEST_EQ("foo/bar/..", "foo/bar/.."); + PATH_TEST_EQ("foo/bar/../..", "foo/bar/../.."); + PATH_TEST_EQ("foo/bar/../blah", "foo/bar/../blah"); + PATH_TEST_EQ("f/../b", "f/../b"); + PATH_TEST_EQ("f/b/..", "f/b/.."); + PATH_TEST_EQ("f/b/../a", "f/b/../a"); + PATH_TEST_EQ("foo/bar/blah/../..", "foo/bar/blah/../.."); + PATH_TEST_EQ("foo/bar/blah/../../bletch", "foo/bar/blah/../../bletch"); + PATH_TEST_EQ("...", "..."); + PATH_TEST_EQ("....", "...."); + PATH_TEST_EQ("foo/...", "foo/..."); + PATH_TEST_EQ("abc.", "abc."); + PATH_TEST_EQ("abc..", "abc.."); + PATH_TEST_EQ("foo/abc.", "foo/abc."); + PATH_TEST_EQ("foo/abc..", "foo/abc.."); + + PATH_TEST_EQ(".abc", ".abc"); + PATH_TEST_EQ("a.c", "a.c"); + PATH_TEST_EQ("..abc", "..abc"); + PATH_TEST_EQ("a..c", "a..c"); + PATH_TEST_EQ("foo/.abc", "foo/.abc"); + PATH_TEST_EQ("foo/a.c", "foo/a.c"); + PATH_TEST_EQ("foo/..abc", "foo/..abc"); + PATH_TEST_EQ("foo/a..c", "foo/a..c"); + + PATH_TEST_EQ(".", "."); + PATH_TEST_EQ("./foo", "./foo"); + PATH_TEST_EQ("./..", "./.."); + PATH_TEST_EQ("./../foo", "./../foo"); + PATH_TEST_EQ("foo/.", "foo/."); + PATH_TEST_EQ("../.", "../."); + PATH_TEST_EQ("./.", "./."); + PATH_TEST_EQ("././.", "././."); + PATH_TEST_EQ("./foo/.", "./foo/."); + PATH_TEST_EQ("foo/./bar", "foo/./bar"); + PATH_TEST_EQ("foo/./.", "foo/./."); + PATH_TEST_EQ("foo/./..", "foo/./.."); + PATH_TEST_EQ("foo/./../bar", "foo/./../bar"); + PATH_TEST_EQ("foo/../.", "foo/../."); + PATH_TEST_EQ("././..", "././.."); + PATH_TEST_EQ("./../.", "./../."); + PATH_TEST_EQ(".././.", ".././."); + } + + // append_tests --------------------------------------------------------------------// + + void append_test_aux(const path & p, const std::string & s, const std::string & expect) + { + PATH_TEST_EQ((p / path(s)).string(), expect); + PATH_TEST_EQ((p / s.c_str()).string(), expect); + PATH_TEST_EQ((p / s).string(), expect); + path x(p); + x.append(s.begin(), s.end()); + PATH_TEST_EQ(x.string(), expect); + } + + void append_tests() + { + std::cout << "append_tests..." << std::endl; + + // There are many control paths to be exercised, since empty paths and arguments, + // paths with trailing separators, arguments with leading separators, with or without + // other characters being present, are all separate cases that need to be tested. + // Furthermore, some of the code to be tested is specific to argument categories, + // so that results in further permutations to be tested. + + //// code to generate test cases + //// + //// expected results must be checked by hand + //// "foo\bar" expected result must be edited by hand and moved for Windows/POSIX + //// + //const char* x[] = { "", "/", "foo", "foo/" }; + //const char* y[] = { "", "/", "bar", "/bar" }; + + //for (int i = 0; i < sizeof(x)/sizeof(char*); ++i) + // for (int j = 0; j < sizeof(y)/sizeof(char*); ++j) + // { + // std::cout << "\n PATH_TEST_EQ(path(\"" << x[i] << "\") / \"" << y[j] << "\", \"" + // << path(x[i]) / y[j] << "\");\n"; + // std::cout << " append_test_aux(\"" << x[i] << "\", \"" << y[j] << "\", \"" + // << path(x[i]) / y[j] << "\");\n"; + // } + + PATH_TEST_EQ(path("") / "", ""); + append_test_aux("", "", ""); + + PATH_TEST_EQ(path("") / "/", "/"); + append_test_aux("", "/", "/"); + + PATH_TEST_EQ(path("") / "bar", "bar"); + append_test_aux("", "bar", "bar"); + + PATH_TEST_EQ(path("") / "/bar", "/bar"); + append_test_aux("", "/bar", "/bar"); + + PATH_TEST_EQ(path("/") / "", "/"); + append_test_aux("/", "", "/"); + + PATH_TEST_EQ(path("/") / "/", "//"); + append_test_aux("/", "/", "//"); + + PATH_TEST_EQ(path("/") / "bar", "/bar"); + append_test_aux("/", "bar", "/bar"); + + PATH_TEST_EQ(path("/") / "/bar", "//bar"); + append_test_aux("/", "/bar", "//bar"); + + PATH_TEST_EQ(path("foo") / "", "foo"); + append_test_aux("foo", "", "foo"); + + PATH_TEST_EQ(path("foo") / "/", "foo/"); + append_test_aux("foo", "/", "foo/"); + + PATH_TEST_EQ(path("foo") / "/bar", "foo/bar"); + append_test_aux("foo", "/bar", "foo/bar"); + + PATH_TEST_EQ(path("foo/") / "", "foo/"); + append_test_aux("foo/", "", "foo/"); + + PATH_TEST_EQ(path("foo/") / "/", "foo//"); + append_test_aux("foo/", "/", "foo//"); + + PATH_TEST_EQ(path("foo/") / "bar", "foo/bar"); + append_test_aux("foo/", "bar", "foo/bar"); + + PATH_TEST_EQ(path("foo/") / "/bar", "foo//bar"); + append_test_aux("foo/", "/bar", "foo//bar"); + + if (platform == "Windows") + { + PATH_TEST_EQ(path("foo") / "bar", "foo\\bar"); + append_test_aux("foo", "bar", "foo\\bar"); + + // hand created test case specific to Windows + PATH_TEST_EQ(path("c:") / "bar", "c:bar"); + append_test_aux("c:", "bar", "c:bar"); + } + else + { + PATH_TEST_EQ(path("foo") / "bar", "foo/bar"); + append_test_aux("foo", "bar", "foo/bar"); + } + + } + +// self_assign_and_append_tests ------------------------------------------------------// + + void self_assign_and_append_tests() + { + std::cout << "self_assign_and_append_tests..." << std::endl; + + path p; + + p = "snafubar"; + PATH_TEST_EQ(p = p, "snafubar"); + + p = "snafubar"; + p = p.c_str(); + PATH_TEST_EQ(p, "snafubar"); + + p = "snafubar"; + p.assign(p.c_str(), path::codecvt()); + PATH_TEST_EQ(p, "snafubar"); + + p = "snafubar"; + PATH_TEST_EQ(p = p.c_str()+5, "bar"); + + p = "snafubar"; + PATH_TEST_EQ(p.assign(p.c_str() + 5, p.c_str() + 7), "ba"); + + p = "snafubar"; + p /= p; + PATH_TEST_EQ(p, "snafubar" BOOST_DIR_SEP "snafubar"); + + p = "snafubar"; + p /= p.c_str(); + PATH_TEST_EQ(p, "snafubar" BOOST_DIR_SEP "snafubar"); + + p = "snafubar"; + p.append(p.c_str(), path::codecvt()); + PATH_TEST_EQ(p, "snafubar" BOOST_DIR_SEP "snafubar"); + + p = "snafubar"; + PATH_TEST_EQ(p.append(p.c_str() + 5, p.c_str() + 7), "snafubar" BOOST_DIR_SEP "ba"); + } + + + // name_function_tests -------------------------------------------------------------// + + void name_function_tests() + { + std::cout << "name_function_tests..." << std::endl; + + BOOST_TEST(fs::portable_posix_name(std::string("x"))); + BOOST_TEST(fs::windows_name(std::string("x"))); + BOOST_TEST(fs::portable_name(std::string("x"))); + BOOST_TEST(fs::portable_directory_name(std::string("x"))); + BOOST_TEST(fs::portable_file_name(std::string("x"))); + + BOOST_TEST(fs::portable_posix_name(std::string("."))); + BOOST_TEST(fs::windows_name(std::string("."))); + BOOST_TEST(fs::portable_name(std::string("."))); + BOOST_TEST(fs::portable_directory_name(std::string("."))); + BOOST_TEST(!fs::portable_file_name(std::string("."))); + + BOOST_TEST(fs::portable_posix_name(std::string(".."))); + BOOST_TEST(fs::windows_name(std::string(".."))); + BOOST_TEST(fs::portable_name(std::string(".."))); + BOOST_TEST(fs::portable_directory_name(std::string(".."))); + BOOST_TEST(!fs::portable_file_name(std::string(".."))); + + BOOST_TEST(!fs::native(std::string(""))); + BOOST_TEST(!fs::portable_posix_name(std::string(""))); + BOOST_TEST(!fs::windows_name(std::string(""))); + BOOST_TEST(!fs::portable_name(std::string(""))); + BOOST_TEST(!fs::portable_directory_name(std::string(""))); + BOOST_TEST(!fs::portable_file_name(std::string(""))); + + BOOST_TEST(!fs::native(std::string(" "))); + BOOST_TEST(!fs::portable_posix_name(std::string(" "))); + BOOST_TEST(!fs::windows_name(std::string(" "))); + BOOST_TEST(!fs::portable_name(std::string(" "))); + BOOST_TEST(!fs::portable_directory_name(std::string(" "))); + BOOST_TEST(!fs::portable_file_name(std::string(" "))); + + BOOST_TEST(!fs::portable_posix_name(std::string(":"))); + BOOST_TEST(!fs::windows_name(std::string(":"))); + BOOST_TEST(!fs::portable_name(std::string(":"))); + BOOST_TEST(!fs::portable_directory_name(std::string(":"))); + BOOST_TEST(!fs::portable_file_name(std::string(":"))); + + BOOST_TEST(fs::portable_posix_name(std::string("-"))); + BOOST_TEST(fs::windows_name(std::string("-"))); + BOOST_TEST(!fs::portable_name(std::string("-"))); + BOOST_TEST(!fs::portable_directory_name(std::string("-"))); + BOOST_TEST(!fs::portable_file_name(std::string("-"))); + + BOOST_TEST(!fs::portable_posix_name(std::string("foo bar"))); + BOOST_TEST(fs::windows_name(std::string("foo bar"))); + BOOST_TEST(!fs::windows_name(std::string(" bar"))); + BOOST_TEST(!fs::windows_name(std::string("foo "))); + BOOST_TEST(!fs::portable_name(std::string("foo bar"))); + BOOST_TEST(!fs::portable_directory_name(std::string("foo bar"))); + BOOST_TEST(!fs::portable_file_name(std::string("foo bar"))); + + BOOST_TEST(fs::portable_posix_name(std::string("foo.bar"))); + BOOST_TEST(fs::windows_name(std::string("foo.bar"))); + BOOST_TEST(fs::portable_name(std::string("foo.bar"))); + BOOST_TEST(!fs::portable_directory_name(std::string("foo.bar"))); + BOOST_TEST(fs::portable_file_name(std::string("foo.bar"))); + + BOOST_TEST(fs::portable_posix_name(std::string("foo.barf"))); + BOOST_TEST(fs::windows_name(std::string("foo.barf"))); + BOOST_TEST(fs::portable_name(std::string("foo.barf"))); + BOOST_TEST(!fs::portable_directory_name(std::string("foo.barf"))); + BOOST_TEST(!fs::portable_file_name(std::string("foo.barf"))); + + BOOST_TEST(fs::portable_posix_name(std::string(".foo"))); + BOOST_TEST(fs::windows_name(std::string(".foo"))); + BOOST_TEST(!fs::portable_name(std::string(".foo"))); + BOOST_TEST(!fs::portable_directory_name(std::string(".foo"))); + BOOST_TEST(!fs::portable_file_name(std::string(".foo"))); + + BOOST_TEST(fs::portable_posix_name(std::string("foo."))); + BOOST_TEST(!fs::windows_name(std::string("foo."))); + BOOST_TEST(!fs::portable_name(std::string("foo."))); + BOOST_TEST(!fs::portable_directory_name(std::string("foo."))); + BOOST_TEST(!fs::portable_file_name(std::string("foo."))); + } + + // replace_extension_tests ---------------------------------------------------------// + + void replace_extension_tests() + { + std::cout << "replace_extension_tests..." << std::endl; + + BOOST_TEST(path().replace_extension().empty()); + BOOST_TEST(path().replace_extension("a").empty()); + BOOST_TEST(path().replace_extension("a.") == "."); + BOOST_TEST(path().replace_extension("a.txt") == ".txt"); + // see the rationale in html docs for explanation why this works: + BOOST_TEST(path().replace_extension(".txt") == ".txt"); + + BOOST_TEST(path("a.txt").replace_extension() == "a"); + BOOST_TEST(path("a.txt").replace_extension("") == "a"); + BOOST_TEST(path("a.txt").replace_extension(".") == "a."); + BOOST_TEST(path("a.txt").replace_extension(".tex") == "a.tex"); + BOOST_TEST(path("a.txt").replace_extension("tex") == "a"); + BOOST_TEST(path("a.").replace_extension(".tex") == "a.tex"); + BOOST_TEST(path("a.").replace_extension("tex") == "a"); + BOOST_TEST(path("a").replace_extension(".txt") == "a.txt"); + BOOST_TEST(path("a").replace_extension("txt") == "a"); + BOOST_TEST(path("a.b.txt").replace_extension(".tex") == "a.b.tex"); + BOOST_TEST(path("a.b.txt").replace_extension("tex") == "a.b"); + BOOST_TEST(path("a/b").replace_extension(".c") == "a/b.c"); + PATH_TEST_EQ(path("a.txt/b").replace_extension(".c"), "a.txt/b.c"); // ticket 4702 + } + + // make_preferred_tests ------------------------------------------------------------// + + void make_preferred_tests() + { + std::cout << "make_preferred_tests..." << std::endl; + + if (platform == "Windows") + { + BOOST_TEST(path("//abc\\def/ghi").make_preferred().native() + == path("\\\\abc\\def\\ghi").native()); + } + else + { + BOOST_TEST(path("//abc\\def/ghi").make_preferred().native() + == path("//abc\\def/ghi").native()); + } + } + +} // unnamed namespace + +//--------------------------------------------------------------------------------------// +// // +// main // +// // +//--------------------------------------------------------------------------------------// + +int cpp_main(int, char*[]) +{ + // The choice of platform is make at runtime rather than compile-time + // so that compile errors for all platforms will be detected even though + // only the current platform is runtime tested. + platform = (platform == "Win32" || platform == "Win64" || platform == "Cygwin") + ? "Windows" + : "POSIX"; + std::cout << "Platform is " << platform << '\n'; + + BOOST_TEST(p1.string() != p3.string()); + p3 = p2; + BOOST_TEST(p1.string() == p3.string()); + + path p4("foobar"); + BOOST_TEST(p4.string() == "foobar"); + p4 = p4; // self-assignment + BOOST_TEST(p4.string() == "foobar"); + + construction_tests(); + append_tests(); + self_assign_and_append_tests(); + overload_tests(); + query_and_decomposition_tests(); + composition_tests(); + iterator_tests(); + non_member_tests(); + exception_tests(); + name_function_tests(); + replace_extension_tests(); + make_preferred_tests(); + + // verify deprecated names still available + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + + p1.branch_path(); + p1.leaf(); + path p_remove_leaf; + p_remove_leaf.remove_leaf(); + +# endif + + std::string s1("//:somestring"); // this used to be treated specially + + // check the path member templates + p5.assign(s1.begin(), s1.end()); + + PATH_TEST_EQ(p5.string(), "//:somestring"); + p5 = s1; + PATH_TEST_EQ(p5.string(), "//:somestring"); + + // this code, courtesy of David Whetstone, detects a now fixed bug that + // derefereced the end iterator (assuming debug build with checked itors) + std::vector<char> v1; + p5.assign(v1.begin(), v1.end()); + std::string s2(v1.begin(), v1.end()); + PATH_TEST_EQ(p5.string(), s2); + p5.assign(s1.begin(), s1.begin() + 1); + PATH_TEST_EQ(p5.string(), "/"); + + BOOST_TEST(p1 != p4); + BOOST_TEST(p1.string() == p2.string()); + BOOST_TEST(p1.string() == p3.string()); + BOOST_TEST(path("foo").filename() == "foo"); + BOOST_TEST(path("foo").parent_path().string() == ""); + BOOST_TEST(p1.filename() == "fum"); + BOOST_TEST(p1.parent_path().string() == "fe/fi/fo"); + BOOST_TEST(path("").empty() == true); + BOOST_TEST(path("foo").empty() == false); + + // inserter and extractor tests +# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // bypass VC++ 7.0 and earlier + std::cout << "\nInserter and extractor test..."; + std::stringstream ss; + ss << fs::path("foo/bar") << std::endl; + fs::path round_trip; + ss >> round_trip; + BOOST_TEST(round_trip.string() == "foo/bar"); + std::cout << round_trip.string() << "..." << round_trip << " complete\n"; +# endif + + return ::boost::report_errors(); +} diff --git a/libs/filesystem/v3/test/path_unit_test.cpp b/libs/filesystem/v3/test/path_unit_test.cpp new file mode 100644 index 0000000000..0e2536be82 --- /dev/null +++ b/libs/filesystem/v3/test/path_unit_test.cpp @@ -0,0 +1,1037 @@ +// filesystem path_unit_test.cpp --------------------------------------------------- // + +// Copyright Beman Dawes 2008, 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +// ---------------------------------------------------------------------------------- // +// +// The purpose of this test is to ensure that each function in the public +// interface can be called with arguments of the appropriate types. It does +// not attempt to verify that the full range of values for each argument +// are processed correctly. +// +// For full functionality tests, including probes with many different argument +// values, see path_test.cpp and other test programs. +// +// ---------------------------------------------------------------------------------- // + +#define BOOST_FILESYSTEM_VERSION 3 + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/config/warning_disable.hpp> + +// See deprecated_test for tests of deprecated features +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +# define BOOST_FILESYSTEM_NO_DEPRECATED +#endif +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/detail/utf8_codecvt_facet.hpp> // for imbue tests +#include "test_codecvt.hpp" // for codecvt arg tests +#include <boost/detail/lightweight_test.hpp> +#include <boost/detail/lightweight_main.hpp> +#include <boost/smart_ptr.hpp> // used constructor tests +#include <boost/functional/hash.hpp> + +#include <iostream> +#include <iomanip> +#include <sstream> +#include <string> +#include <cstring> +#include <cwchar> +#include <locale> +#include <list> + +namespace fs = boost::filesystem; +namespace bs = boost::system; +using boost::filesystem::path; +using std::cout; +using std::endl; +using std::string; +using std::wstring; + +#define CHECK(x) check(x, __FILE__, __LINE__) +#define PATH_IS(a, b) check_path(a, b, __FILE__, __LINE__) +#define NATIVE_IS(p, s, ws) check_native(p, s, ws, __FILE__, __LINE__) +#define IS(a,b) check_equal(a, b, __FILE__, __LINE__) + +#if defined(_MSC_VER) +# pragma warning(push) // Save warning settings. +# pragma warning(disable : 4428) // Disable universal-character-name encountered in source warning. +#endif + +namespace +{ + + boost::system::error_code ec; + const boost::system::error_code ok; + const boost::system::error_code ng(-1, boost::system::system_category()); + + std::string platform(BOOST_PLATFORM); + + void check_path(const path& source, + const wstring& expected, const char* file, int line) + { + if (source == expected) return; + + ++::boost::detail::test_errors(); + + std::cout << file; + std::wcout << L'(' << line << L"): source.wstring(): \"" + << source.wstring() + << L"\" != expected: \"" << expected + << L"\"\n" ; + } + +# ifdef BOOST_WINDOWS_API + void check_native(const path& p, + const string&, const wstring& expected, const char* file, int line) +# else + void check_native(const path& p, + const string& expected, const wstring&, const char* file, int line) +# endif + { + if (p.native() == expected) return; + + ++::boost::detail::test_errors(); + + std::cout << file << '(' << line << "): native() is not equal expected\n" + " native---: " << std::hex; + path::string_type nat(p.native()); + for (path::string_type::const_iterator it = nat.begin(); it != nat.end(); ++it) + std::cout << long(*it) << ' '; + std::cout << "\n expected-: "; + for (path::string_type::const_iterator it = expected.begin(); it != expected.end(); ++it) + std::cout << long(*it) << ' '; + std::cout << std::dec << std::endl; + } + + template< class T1, class T2 > + void check_equal(const T1& value, + const T2& expected, const char* file, int line) + { + if (value == expected) return; + + ++::boost::detail::test_errors(); + + std::cout << file; + + std::wcout << L'(' << line << L"): value: \"" << value + << L"\" != expected: \"" << expected + << L"\"\n" ; + } + + void check(bool ok, const char* file, int line) + { + if (ok) return; + + ++::boost::detail::test_errors(); + + std::cout << file << '(' << line << "): test failed\n"; + } + + string s("string"); + wstring ws(L"wstring"); + std::list<char> l; // see main() for initialization to s, t, r, i, n, g + std::list<wchar_t> wl; // see main() for initialization to w, s, t, r, i, n, g + std::vector<char> v; // see main() for initialization to f, u, z + std::vector<wchar_t> wv; // see main() for initialization to w, f, u, z + + class Base {}; + class Derived : public Base {}; + void fun(const boost::filesystem::path&) {} + void fun(const boost::shared_ptr< Base >&) {} + + // test_constructors ---------------------------------------------------------------// + + void test_constructors() + { + std::cout << "testing constructors..." << std::endl; + + path x0; // default constructor + PATH_IS(x0, L""); + BOOST_TEST_EQ(x0.native().size(), 0U); + + path x1(l.begin(), l.end()); // iterator range char + PATH_IS(x1, L"string"); + BOOST_TEST_EQ(x1.native().size(), 6U); + + path x2(x1); // copy constructor + PATH_IS(x2, L"string"); + BOOST_TEST_EQ(x2.native().size(), 6U); + + path x3(wl.begin(), wl.end()); // iterator range wchar_t + PATH_IS(x3, L"wstring"); + BOOST_TEST_EQ(x3.native().size(), 7U); + + // contiguous containers + path x4(string("std::string")); // std::string + PATH_IS(x4, L"std::string"); + BOOST_TEST_EQ(x4.native().size(), 11U); + + path x5(wstring(L"std::wstring")); // std::wstring + PATH_IS(x5, L"std::wstring"); + BOOST_TEST_EQ(x5.native().size(), 12U); + + path x4v(v); // std::vector<char> + PATH_IS(x4v, L"fuz"); + BOOST_TEST_EQ(x4v.native().size(), 3U); + + path x5v(wv); // std::vector<wchar_t> + PATH_IS(x5v, L"wfuz"); + BOOST_TEST_EQ(x5v.native().size(), 4U); + + path x6("array char"); // array char + PATH_IS(x6, L"array char"); + BOOST_TEST_EQ(x6.native().size(), 10U); + + path x7(L"array wchar_t"); // array wchar_t + PATH_IS(x7, L"array wchar_t"); + BOOST_TEST_EQ(x7.native().size(), 13U); + + char char_array[100]; + std::strcpy(char_array, "big array char"); + path x6o(char_array); // array char, only partially full + PATH_IS(x6o, L"big array char"); + BOOST_TEST_EQ(x6o.native().size(), 14U); + + wchar_t wchar_array[100]; + std::wcscpy(wchar_array, L"big array wchar_t"); + path x7o(wchar_array); // array char, only partially full + PATH_IS(x7o, L"big array wchar_t"); + BOOST_TEST_EQ(x7o.native().size(), 17U); + + path x8(s.c_str()); // const char* null terminated + PATH_IS(x8, L"string"); + BOOST_TEST_EQ(x8.native().size(), 6U); + + path x9(ws.c_str()); // const wchar_t* null terminated + PATH_IS(x9, L"wstring"); + BOOST_TEST_EQ(x9.native().size(), 7U); + + // non-contiguous containers + path x10(l); // std::list<char> + PATH_IS(x10, L"string"); + BOOST_TEST_EQ(x10.native().size(), 6U); + + path xll(wl); // std::list<wchar_t> + PATH_IS(xll, L"wstring"); + BOOST_TEST_EQ(xll.native().size(), 7U); + + // easy-to-make coding errors + // path e1(x0, path::codecvt()); // fails to compile, and that is OK + + boost::shared_ptr< Derived > pDerived( new Derived() ); + fun( pDerived ); // tests constructor member template enable_if working correctly; + // will fail to compile if enable_if not taking path off the table + } + + path x; + path y; + + // test_assignments ----------------------------------------------------------------// + + void test_assignments() + { + std::cout << "testing assignments..." << std::endl; + + x = path("yet another path"); // another path + PATH_IS(x, L"yet another path"); + BOOST_TEST_EQ(x.native().size(), 16U); + + x = x; // self-assignment + PATH_IS(x, L"yet another path"); + BOOST_TEST_EQ(x.native().size(), 16U); + + x.assign(l.begin(), l.end()); // iterator range char + PATH_IS(x, L"string"); + + x.assign(wl.begin(), wl.end()); // iterator range wchar_t + PATH_IS(x, L"wstring"); + + x = string("std::string"); // container char + PATH_IS(x, L"std::string"); + + x = wstring(L"std::wstring"); // container wchar_t + PATH_IS(x, L"std::wstring"); + + x = "array char"; // array char + PATH_IS(x, L"array char"); + + x = L"array wchar"; // array wchar_t + PATH_IS(x, L"array wchar"); + + x = s.c_str(); // const char* null terminated + PATH_IS(x, L"string"); + + x = ws.c_str(); // const wchar_t* null terminated + PATH_IS(x, L"wstring"); + } + + // test_appends --------------------------------------------------------------------// + + void test_appends() + { + std::cout << "testing appends..." << std::endl; + +# ifdef BOOST_WINDOWS_API +# define BOOST_FS_FOO L"/foo\\" +# else // POSIX paths +# define BOOST_FS_FOO L"/foo/" +# endif + + x = "/foo"; + x /= path(""); // empty path + PATH_IS(x, L"/foo"); + + x = "/foo"; + x /= path("/"); // slash path + PATH_IS(x, L"/foo/"); + + x = "/foo"; + x /= path("/boo"); // slash path + PATH_IS(x, L"/foo/boo"); + + x = "/foo"; + x /= x; // self-append + PATH_IS(x, L"/foo/foo"); + + x = "/foo"; + x /= path("yet another path"); // another path + PATH_IS(x, BOOST_FS_FOO L"yet another path"); + + x = "/foo"; + x.append(l.begin(), l.end()); // iterator range char + PATH_IS(x, BOOST_FS_FOO L"string"); + + x = "/foo"; + x.append(wl.begin(), wl.end()); // iterator range wchar_t + PATH_IS(x, BOOST_FS_FOO L"wstring"); + + x = "/foo"; + x /= string("std::string"); // container char + PATH_IS(x, BOOST_FS_FOO L"std::string"); + + x = "/foo"; + x /= wstring(L"std::wstring"); // container wchar_t + PATH_IS(x, BOOST_FS_FOO L"std::wstring"); + + x = "/foo"; + x /= "array char"; // array char + PATH_IS(x, BOOST_FS_FOO L"array char"); + + x = "/foo"; + x /= L"array wchar"; // array wchar_t + PATH_IS(x, BOOST_FS_FOO L"array wchar"); + + x = "/foo"; + x /= s.c_str(); // const char* null terminated + PATH_IS(x, BOOST_FS_FOO L"string"); + + x = "/foo"; + x /= ws.c_str(); // const wchar_t* null terminated + PATH_IS(x, BOOST_FS_FOO L"wstring"); + } + + // test_observers ------------------------------------------------------------------// + + void test_observers() + { + std::cout << "testing observers..." << std::endl; + + path p0("abc"); + + CHECK(p0.native().size() == 3); + CHECK(p0.string() == "abc"); + CHECK(p0.string().size() == 3); + CHECK(p0.wstring() == L"abc"); + CHECK(p0.wstring().size() == 3); + +# ifdef BOOST_WINDOWS_API + + path p("abc\\def/ghi"); + + CHECK(std::wstring(p.c_str()) == L"abc\\def/ghi"); + + CHECK(p.string() == "abc\\def/ghi"); + CHECK(p.wstring() == L"abc\\def/ghi"); + + CHECK(p.generic_string() == "abc/def/ghi"); + CHECK(p.generic_wstring() == L"abc/def/ghi"); + + CHECK(p.generic_string<string>() == "abc/def/ghi"); + CHECK(p.generic_string<wstring>() == L"abc/def/ghi"); + CHECK(p.generic_string<path::string_type>() == L"abc/def/ghi"); + +# else // BOOST_POSIX_API + + path p("abc\\def/ghi"); + + CHECK(string(p.c_str()) == "abc\\def/ghi"); + + CHECK(p.string() == "abc\\def/ghi"); + CHECK(p.wstring() == L"abc\\def/ghi"); + + CHECK(p.generic_string() == "abc\\def/ghi"); + CHECK(p.generic_wstring() == L"abc\\def/ghi"); + + CHECK(p.generic_string<string>() == "abc\\def/ghi"); + CHECK(p.generic_string<wstring>() == L"abc\\def/ghi"); + CHECK(p.generic_string<path::string_type>() == "abc\\def/ghi"); + +# endif + } + + // test_relationals ----------------------------------------------------------------// + + void test_relationals() + { + std::cout << "testing relationals..." << std::endl; + + boost::hash<path> hash; + +# ifdef BOOST_WINDOWS_API + // this is a critical use case to meet user expectations + CHECK(path("c:\\abc") == path("c:/abc")); + CHECK(hash(path("c:\\abc")) == hash(path("c:/abc"))); +# endif + + const path p("bar"); + const path p2("baz"); + + CHECK(!(p < p)); + CHECK(p < p2); + CHECK(!(p2 < p)); + CHECK(p < "baz"); + CHECK(p < string("baz")); + CHECK(p < L"baz"); + CHECK(p < wstring(L"baz")); + CHECK(!("baz" < p)); + CHECK(!(string("baz") < p)); + CHECK(!(L"baz" < p)); + CHECK(!(wstring(L"baz") < p)); + + CHECK(p == p); + CHECK(!(p == p2)); + CHECK(!(p2 == p)); + CHECK(p2 == "baz"); + CHECK(p2 == string("baz")); + CHECK(p2 == L"baz"); + CHECK(p2 == wstring(L"baz")); + CHECK("baz" == p2); + CHECK(string("baz") == p2); + CHECK(L"baz" == p2); + CHECK(wstring(L"baz") == p2); + + CHECK(hash(p) == hash(p)); + CHECK(hash(p) != hash(p2)); // Not strictly required, but desirable + + CHECK(!(p != p)); + CHECK(p != p2); + CHECK(p2 != p); + + CHECK(p <= p); + CHECK(p <= p2); + CHECK(!(p2 <= p)); + + CHECK(!(p > p)); + CHECK(!(p > p2)); + CHECK(p2 > p); + + CHECK(p >= p); + CHECK(!(p >= p2)); + CHECK(p2 >= p); +} + + // test_inserter_and_extractor -----------------------------------------------------// + + void test_inserter_and_extractor() + { + std::cout << "testing inserter and extractor..." << std::endl; + + path p1("foo bar"); // verify space in path roundtrips per ticket #3863 + path p2; + + std::stringstream ss; + + CHECK(p1 != p2); + ss << p1; + ss >> p2; + CHECK(p1 == p2); + + path wp1(L"foo bar"); + path wp2; + + std::wstringstream wss; + + CHECK(wp1 != wp2); + wss << wp1; + wss >> wp2; + CHECK(wp1 == wp2); + } + + // test_other_non_members ----------------------------------------------------------// + + void test_other_non_members() + { + std::cout << "testing other_non_members..." << std::endl; + + path p1("foo"); + path p2("bar"); + + // operator / + + CHECK(p1 / p2 == path("foo/bar").make_preferred()); + CHECK("foo" / p2 == path("foo/bar").make_preferred()); + CHECK(L"foo" / p2 == path("foo/bar").make_preferred()); + CHECK(string("foo") / p2 == path("foo/bar").make_preferred()); + CHECK(wstring(L"foo") / p2 == path("foo/bar").make_preferred()); + CHECK(p1 / "bar" == path("foo/bar").make_preferred()); + CHECK(p1 / L"bar" == path("foo/bar").make_preferred()); + CHECK(p1 / string("bar") == path("foo/bar").make_preferred()); + CHECK(p1 / wstring(L"bar") == path("foo/bar").make_preferred()); + + swap(p1, p2); + + CHECK(p1 == "bar"); + CHECK(p2 == "foo"); + + CHECK(path("").remove_filename() == ""); + CHECK(path("foo").remove_filename() == ""); + CHECK(path("foo/bar").remove_filename() == "foo"); + } + +// // test_modifiers ------------------------------------------------------------------// +// +// void test_modifiers() +// { +// std::cout << "testing modifiers..." << std::endl; +// +// } + + // test_iterators ------------------------------------------------------------------// + + void test_iterators() + { + std::cout << "testing iterators..." << std::endl; + + path p1; + CHECK(p1.begin() == p1.end()); + + path p2("/"); + CHECK(p2.begin() != p2.end()); + CHECK(*p2.begin() == "/"); + CHECK(++p2.begin() == p2.end()); + + path p3("foo/bar/baz"); + + path::iterator it(p3.begin()); + CHECK(p3.begin() != p3.end()); + CHECK(*it == "foo"); + CHECK(*++it == "bar"); + CHECK(*++it == "baz"); + CHECK(*--it == "bar"); + CHECK(*--it == "foo"); + CHECK(*++it == "bar"); + CHECK(*++it == "baz"); + CHECK(++it == p3.end()); + } + + // test_modifiers ------------------------------------------------------------------// + + void test_modifiers() + { + std::cout << "testing modifiers..." << std::endl; + + } + + // test_decompositions -------------------------------------------------------------// + + void test_decompositions() + { + std::cout << "testing decompositions..." << std::endl; + + CHECK(path("").root_name().string() == ""); + CHECK(path("foo").root_name().string() == ""); + CHECK(path("/").root_name().string() == ""); + CHECK(path("/foo").root_name().string() == ""); + CHECK(path("//netname").root_name().string() == "//netname"); + CHECK(path("//netname/foo").root_name().string() == "//netname"); + + CHECK(path("").root_directory().string() == ""); + CHECK(path("foo").root_directory().string() == ""); + CHECK(path("/").root_directory().string() == "/"); + CHECK(path("/foo").root_directory().string() == "/"); + CHECK(path("//netname").root_directory().string() == ""); + CHECK(path("//netname/foo").root_directory().string() == "/"); + + CHECK(path("").root_path().string() == ""); + CHECK(path("/").root_path().string() == "/"); + CHECK(path("/foo").root_path().string() == "/"); + CHECK(path("//netname").root_path().string() == "//netname"); + CHECK(path("//netname/foo").root_path().string() == "//netname/"); + +# ifdef BOOST_WINDOWS_API + CHECK(path("c:/foo").root_path().string() == "c:/"); +# endif + + CHECK(path("").relative_path().string() == ""); + CHECK(path("/").relative_path().string() == ""); + CHECK(path("/foo").relative_path().string() == "foo"); + + CHECK(path("").parent_path().string() == ""); + CHECK(path("/").parent_path().string() == ""); + CHECK(path("/foo").parent_path().string() == "/"); + CHECK(path("/foo/bar").parent_path().string() == "/foo"); + + CHECK(path("/foo/bar/baz.zoo").filename().string() == "baz.zoo"); + + CHECK(path("/foo/bar/baz.zoo").stem().string() == "baz"); + CHECK(path("/foo/bar.woo/baz").stem().string() == "baz"); + + CHECK(path("foo.bar.baz.tar.bz2").extension().string() == ".bz2"); + CHECK(path("/foo/bar/baz.zoo").extension().string() == ".zoo"); + CHECK(path("/foo/bar.woo/baz").extension().string() == ""); + } + + // test_queries --------------------------------------------------------------------// + + void test_queries() + { + std::cout << "testing queries..." << std::endl; + + path p1(""); + path p2("//netname/foo.doo"); + + CHECK(p1.empty()); + CHECK(!p1.has_root_path()); + CHECK(!p1.has_root_name()); + CHECK(!p1.has_root_directory()); + CHECK(!p1.has_relative_path()); + CHECK(!p1.has_parent_path()); + CHECK(!p1.has_filename()); + CHECK(!p1.has_stem()); + CHECK(!p1.has_extension()); + CHECK(!p1.is_absolute()); + CHECK(p1.is_relative()); + + CHECK(!p2.empty()); + CHECK(p2.has_root_path()); + CHECK(p2.has_root_name()); + CHECK(p2.has_root_directory()); + CHECK(p2.has_relative_path()); + CHECK(p2.has_parent_path()); + CHECK(p2.has_filename()); + CHECK(p2.has_stem()); + CHECK(p2.has_extension()); + CHECK(p2.is_absolute()); + CHECK(!p2.is_relative()); + + } + + // test_imbue_locale ---------------------------------------------------------------// + + void test_imbue_locale() + { + std::cout << "testing imbue locale..." << std::endl; + + // weak test case for before/after states since we don't know what characters the + // default locale accepts. + path before("abc"); + + // So that tests are run with known encoding, use Boost UTF-8 codecvt + // \u2722 and \xE2\x9C\xA2 are UTF-16 and UTF-8 FOUR TEARDROP-SPOKED ASTERISK + + std::locale global_loc = std::locale(); + std::locale loc(global_loc, new fs::detail::utf8_codecvt_facet); + std::cout << " imbuing locale ..." << std::endl; + std::locale old_loc = path::imbue(loc); + + std::cout << " testing with the imbued locale ..." << std::endl; + path p2("\xE2\x9C\xA2"); + CHECK(p2 == L"\u2722"); + CHECK(p2.wstring() == L"\u2722"); + + std::cout << " imbuing the original locale ..." << std::endl; + path::imbue(old_loc); + + std::cout << " testing with the original locale ..." << std::endl; + path after("abc"); + CHECK(before == after); + + std::cout << " locale testing complete" << std::endl; + } + + // test_codecvt_argument -----------------------------------------------------------// + + void test_codecvt_argument() + { + std::cout << "testing codecvt arguments..." << std::endl; + + const char * c1 = "a1"; + const std::string s1(c1); + const std::wstring ws1(L"b2"); // off-by-one mimics test_codecvt + const std::string s2("y8"); + const std::wstring ws2(L"z9"); + + test_codecvt cvt; // produces off-by-one values that will always differ from + // the system's default locale codecvt facet + + int t = 0; + + // constructors + std::cout << " constructors test " << ++t << std::endl; + path p(c1, cvt); + NATIVE_IS(p, s1, ws1); + + std::cout << " test " << ++t << std::endl; + path p1(s1.begin(), s1.end(), cvt); + NATIVE_IS(p1, s1, ws1); + + std::cout << " test " << ++t << std::endl; + path p2(ws2, cvt); + NATIVE_IS(p2, s2, ws2); + + std::cout << " test " << ++t << std::endl; + path p3(ws2.begin(), ws2.end(), cvt); + NATIVE_IS(p3, s2, ws2); + + // path p2(p1, cvt); // fails to compile, and that is OK + + // assigns + p1.clear(); + std::cout << " assigns test " << ++t << std::endl; + p1.assign(s1,cvt); + NATIVE_IS(p1, s1, ws1); + p1.clear(); + std::cout << " test " << ++t << std::endl; + p1.assign(s1.begin(), s1.end(), cvt); + NATIVE_IS(p1, s1, ws1); + // p1.assign(p, cvt); // fails to compile, and that is OK + + // appends + p1.clear(); + std::cout << " appends test " << ++t << std::endl; + p1.append(s1,cvt); + NATIVE_IS(p1, s1, ws1); + p1.clear(); + std::cout << " test " << ++t << std::endl; + p1.append(s1.begin(), s1.end(), cvt); + NATIVE_IS(p1, s1, ws1); + // p1.append(p, cvt); // fails to compile, and that is OK + + // native observers + std::cout << " native observers test " << ++t << std::endl; + CHECK(p.string<std::string>(cvt) == s1); + std::cout << " test " << ++t << std::endl; + CHECK(p.string(cvt) == s1); + std::cout << " test " << ++t << std::endl; + CHECK(p.string<std::wstring>(cvt) == ws1); + std::cout << " test " << ++t << std::endl; + CHECK(p.wstring(cvt) == ws1); + + // generic observers + std::cout << " generic observers test " << ++t << std::endl; + CHECK(p.generic_string<std::string>(cvt) == s1); + std::cout << " test " << ++t << std::endl; + CHECK(p.generic_string(cvt) == s1); + std::cout << " test " << ++t << std::endl; + CHECK(p.generic_string<std::wstring>(cvt) == ws1); + std::cout << " test " << ++t << std::endl; + CHECK(p.generic_wstring(cvt) == ws1); + + std::cout << " codecvt arguments testing complete" << std::endl; + } + + // test_overloads ------------------------------------------------------------------// + + void test_overloads() + { + std::cout << "testing overloads..." << std::endl; + std::string s("hello"); + const char a[] = "goodbye"; + path p1(s); + path p2(s.c_str()); + path p3(a); + path p4("foo"); + + std::wstring ws(L"hello"); + const wchar_t wa[] = L"goodbye"; + path wp1(ws); + path wp2(ws.c_str()); + path wp3(wa); + path wp4(L"foo"); + } + + // test_error_handling -------------------------------------------------------------// + + class error_codecvt + : public std::codecvt< wchar_t, char, std::mbstate_t > + { + public: + explicit error_codecvt() + : std::codecvt<wchar_t, char, std::mbstate_t>() {} + protected: + + virtual bool do_always_noconv() const throw() { return false; } + virtual int do_encoding() const throw() { return 0; } + + virtual std::codecvt_base::result do_in(std::mbstate_t&, + const char*, const char*, const char*&, + wchar_t*, wchar_t*, wchar_t*&) const + { + static std::codecvt_base::result r = std::codecvt_base::noconv; + if (r == std::codecvt_base::partial) r = std::codecvt_base::error; + else if (r == std::codecvt_base::error) r = std::codecvt_base::noconv; + else r = std::codecvt_base::partial; + return r; + } + + virtual std::codecvt_base::result do_out(std::mbstate_t &, + const wchar_t*, const wchar_t*, const wchar_t*&, + char*, char*, char*&) const + { + static std::codecvt_base::result r = std::codecvt_base::noconv; + if (r == std::codecvt_base::partial) r = std::codecvt_base::error; + else if (r == std::codecvt_base::error) r = std::codecvt_base::noconv; + else r = std::codecvt_base::partial; + return r; + } + + virtual std::codecvt_base::result do_unshift(std::mbstate_t&, + char*, char*, char* &) const { return ok; } + virtual int do_length(std::mbstate_t &, + const char*, const char*, std::size_t) const { return 0; } + virtual int do_max_length() const throw () { return 0; } + }; + + void test_error_handling() + { + std::cout << "testing error handling..." << std::endl; + + std::locale global_loc = std::locale(); + std::locale loc(global_loc, new error_codecvt); + std::cout << " imbuing error locale ..." << std::endl; + std::locale old_loc = path::imbue(loc); + + // These tests rely on a path constructor that fails in the locale conversion. + // Thus construction has to call codecvt. Force that by using a narrow string + // for Windows, and a wide string for POSIX. +# ifdef BOOST_WINDOWS_API +# define STRING_FOO_ "foo" +# else +# define STRING_FOO_ L"foo" +# endif + + { + std::cout << " testing std::codecvt_base::partial error..." << std::endl; + bool exception_thrown (false); + try { path(STRING_FOO_); } + catch (const bs::system_error & ex) + { + exception_thrown = true; + BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::partial, + fs::codecvt_error_category())); + } + catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; } + BOOST_TEST(exception_thrown); + } + + { + std::cout << " testing std::codecvt_base::error error..." << std::endl; + bool exception_thrown (false); + try { path(STRING_FOO_); } + catch (const bs::system_error & ex) + { + exception_thrown = true; + BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::error, + fs::codecvt_error_category())); + } + catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; } + BOOST_TEST(exception_thrown); + } + + { + std::cout << " testing std::codecvt_base::noconv error..." << std::endl; + bool exception_thrown (false); + try { path(STRING_FOO_); } + catch (const bs::system_error & ex) + { + exception_thrown = true; + BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::noconv, + fs::codecvt_error_category())); + } + catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; } + BOOST_TEST(exception_thrown); + } + + std::cout << " restoring original locale ..." << std::endl; + path::imbue(old_loc); + std::cout << " testing error handling complete" << std::endl; + } + +# if 0 + +// // test_locales --------------------------------------------------------------------// +// +// void test_locales() +// { +// std::cout << "testing locales..." << std::endl; +// +// } + + // test_user_supplied_type ---------------------------------------------------------// + + typedef std::basic_string<int> user_string; + +} // unnamed namespace + +namespace boost +{ +namespace filesystem +{ + namespace path_traits + { + template<> struct is_iterator<const user_string::value_type *> { static const bool value = true; }; + template<> struct is_iterator<user_string::value_type *> { static const bool value = true; }; + template<> struct is_iterator<user_string::iterator> { static const bool value = true; }; + template<> struct is_iterator<user_string::const_iterator> { static const bool value = true; }; + template<> struct is_container<user_string> { static const bool value = true; }; + + template<> + void append<user_string::value_type>(const user_string::value_type * begin, + const user_string::value_type * end, string_type & target, system::error_code & ec) + { + for (; begin != end && *begin; ++begin) + target += *begin + 1; // change so that results distinguishable from char cvts + } + +# ifdef __GNUC__ + // This specialization shouldn't be needed, and VC++, Intel, and others work + // fine without it. But gcc 4.3.2, and presumably other versions, need it. + template<> + void append<user_string::value_type>(const user_string::value_type * begin, + string_type & target, system::error_code & ec) + { + path_traits::append<user_string::value_type>(begin, + static_cast<const user_string::value_type *>(0), target, ec); + } +# endif + + template<> + user_string convert<user_string>(const string_type & source, + system::error_code & ec) + { + user_string temp; + for (string_type::const_iterator it = source.begin(); + it != source.end(); ++it) + temp += *it - 1; + return temp; + } + } // namespace path_traits +} // namespace filesystem +} // namespace boost + +namespace +{ + + void test_user_supplied_type() + { + std::cout << "testing user supplied type..." << std::endl; + + user_string::value_type usr_c_str[] = { 'a', 'b', 'c', 0 }; + user_string usr(usr_c_str); + + path p1(usr.c_str()); + CHECK(p1 == path("bcd")); + CHECK(p1 == "bcd"); + user_string s1(p1.string<user_string>()); + CHECK(s1 == usr); + } + +# endif + +} // unnamed namespace + +//--------------------------------------------------------------------------------------// +// // +// main // +// // +//--------------------------------------------------------------------------------------// + +int cpp_main(int, char*[]) +{ +// document state of critical macros +#ifdef BOOST_POSIX_API + cout << "BOOST_POSIX_API" << endl; +#endif +#ifdef BOOST_WINDOWS_API + cout << "BOOST_WINDOWS_API" << endl; +#endif + + l.push_back('s'); + l.push_back('t'); + l.push_back('r'); + l.push_back('i'); + l.push_back('n'); + l.push_back('g'); + + wl.push_back(L'w'); + wl.push_back(L's'); + wl.push_back(L't'); + wl.push_back(L'r'); + wl.push_back(L'i'); + wl.push_back(L'n'); + wl.push_back(L'g'); + + v.push_back('f'); + v.push_back('u'); + v.push_back('z'); + + wv.push_back(L'w'); + wv.push_back(L'f'); + wv.push_back(L'u'); + wv.push_back(L'z'); + + test_overloads(); + test_constructors(); + test_assignments(); + test_appends(); + test_modifiers(); + test_observers(); + test_relationals(); + test_inserter_and_extractor(); + test_other_non_members(); + test_iterators(); + test_decompositions(); + test_queries(); + test_imbue_locale(); + test_codecvt_argument(); + test_error_handling(); + +# if 0 + + test_user_supplied_type(); + +#endif + + std::string foo("\\abc"); + const char* bar = "/abc"; + + if (foo == bar) + cout << "unintended consequence\n"; + + return ::boost::report_errors(); +} diff --git a/libs/filesystem/v3/test/test_codecvt.hpp b/libs/filesystem/v3/test/test_codecvt.hpp new file mode 100644 index 0000000000..32b2d36e59 --- /dev/null +++ b/libs/filesystem/v3/test/test_codecvt.hpp @@ -0,0 +1,79 @@ +// test_codecvt.hpp ------------------------------------------------------------------// + +// Copyright Beman Dawes 2009, 2010 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#ifndef BOOST_FILESYSTEM3_TEST_CODECVT_HPP +#define BOOST_FILESYSTEM3_TEST_CODECVT_HPP + +#include <boost/filesystem/v3/config.hpp> +#include <locale> +#include <cwchar> // for mbstate_t + + //------------------------------------------------------------------------------------// + // // + // class test_codecvt // + // // + // Warning: partial implementation; even do_in and do_out only partially meet the // + // standard library specifications as the "to" buffer must hold the entire result. // + // // + // The value of a wide character is the value of the corresponding narrow character // + // plus 1. This ensures that compares against expected values will fail if the // + // code conversion did not occur as expected. // + // // + //------------------------------------------------------------------------------------// + + class test_codecvt + : public std::codecvt< wchar_t, char, std::mbstate_t > + { + public: + explicit test_codecvt() + : std::codecvt<wchar_t, char, std::mbstate_t>() {} + protected: + + virtual bool do_always_noconv() const throw() { return false; } + + virtual int do_encoding() const throw() { return 0; } + + virtual std::codecvt_base::result do_in(std::mbstate_t&, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const + { + for (; from != from_end && to != to_end; ++from, ++to) + *to = *from + 1; + if (to == to_end) + return error; + *to = L'\0'; + from_next = from; + to_next = to; + return ok; + } + + virtual std::codecvt_base::result do_out(std::mbstate_t&, + const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, + char* to, char* to_end, char*& to_next) const + { + for (; from != from_end && to != to_end; ++from, ++to) + *to = static_cast<char>(*from - 1); + if (to == to_end) + return error; + *to = '\0'; + from_next = from; + to_next = to; + return ok; + } + + virtual std::codecvt_base::result do_unshift(std::mbstate_t&, + char* /*from*/, char* /*to*/, char* & /*next*/) const { return ok; } + + virtual int do_length(std::mbstate_t&, + const char* /*from*/, const char* /*from_end*/, std::size_t /*max*/) const { return 0; } + + virtual int do_max_length() const throw () { return 0; } + }; + +#endif // BOOST_FILESYSTEM3_TEST_CODECVT_HPP diff --git a/libs/filesystem/v3/test/windows_attributes.cpp b/libs/filesystem/v3/test/windows_attributes.cpp new file mode 100644 index 0000000000..e1a686ce83 --- /dev/null +++ b/libs/filesystem/v3/test/windows_attributes.cpp @@ -0,0 +1,108 @@ +// windows_attributes ----------------------------------------------------------------// + +// Copyright Beman Dawes 2010 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +// Useful for debugging status related issues // + +//--------------------------------------------------------------------------------------// + +#include <boost/filesystem.hpp> +#include <boost/detail/lightweight_main.hpp> +#include <windows.h> +#include <map> +#include <utility> +#include <iostream> +#include <string> + +using std::make_pair; +namespace fs = boost::filesystem; + +int cpp_main( int argc, char* argv[]) +{ + typedef std::map<DWORD, std::string> decode_type; + decode_type table; + + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_ARCHIVE, "FILE_ATTRIBUTE_ARCHIVE")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_COMPRESSED, "FILE_ATTRIBUTE_COMPRESSED")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_DEVICE, "FILE_ATTRIBUTE_DEVICE")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_DIRECTORY, "FILE_ATTRIBUTE_DIRECTORY")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_ENCRYPTED, "FILE_ATTRIBUTE_ENCRYPTED")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_HIDDEN, "FILE_ATTRIBUTE_HIDDEN")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, "FILE_ATTRIBUTE_NOT_CONTENT_INDEXED")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_OFFLINE, "FILE_ATTRIBUTE_OFFLINE")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_READONLY, "FILE_ATTRIBUTE_READONLY")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_REPARSE_POINT, "FILE_ATTRIBUTE_REPARSE_POINT")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_SPARSE_FILE, "FILE_ATTRIBUTE_SPARSE_FILE")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_SYSTEM, "FILE_ATTRIBUTE_SYSTEM")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_TEMPORARY, "FILE_ATTRIBUTE_TEMPORARY")); + table.insert(make_pair<DWORD, std::string>(FILE_ATTRIBUTE_VIRTUAL, "FILE_ATTRIBUTE_VIRTUAL")); + + if (argc < 2) + { + std::cout << "Usage: windows_attributes path\n"; + return 1; + } + + // report Win32 ::GetFileAttributesA() + + DWORD at(::GetFileAttributesA(argv[1])); + if (at == INVALID_FILE_ATTRIBUTES) + { + std::cout << "GetFileAttributes(\"" << argv[1] + << "\") returned INVALID_FILE_ATTRIBUTES\n"; + return 0; + } + + std::cout << "GetFileAttributes(\"" << argv[1] + << "\") returned "; + + bool bar = false; + for (decode_type::iterator it = table.begin(); it != table.end(); ++it) + { + if (!(it->first & at)) + continue; + if (bar) + std::cout << " | "; + bar = true; + std::cout << it->second; + at &= ~it->first; + } + std::cout << std::endl; + + if (at) + std::cout << "plus unknown attributes " << at << std::endl; + + // report Boost Filesystem file_type + + fs::file_status stat = fs::status(argv[1]); + + const char* types[] = + { + "status_error", + "file_not_found", + "regular_file", + "directory_file", + // the following may not apply to some operating systems or file systems + "symlink_file", + "block_file", + "character_file", + "fifo_file", + "socket_file", + "reparse_file", // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink + "type_unknown", // file does exist", but isn't one of the above types or + // we don't have strong enough permission to find its type + + "_detail_directory_symlink" // internal use only; never exposed to users + }; + + std::cout << "boost::filesystem::status().type() is " << types[stat.type()] << std::endl; + + return 0; +} |