#1398 Removed dependency on system boost, added subset of boost to ThirdParty

Added a subset of boost to ThirdParty folder. Code extracted from version boost version 1.59.0
This commit is contained in:
Magne Sjaastad
2017-04-05 08:34:52 +02:00
parent 6c7dfdca7b
commit 2b4efc4b5c
1617 changed files with 261070 additions and 88 deletions

View File

@@ -0,0 +1,19 @@
# Boost Filesystem Library Bug report Jamfile
# Copyright Beman Dawes 2014
# 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 bug : bug.cpp : <link>static ;
# install in ./bin; invoke via "b2", not "b2 install"
install bin : bug ;

View File

@@ -0,0 +1,19 @@
// filesystem/bug/bug.cpp
#include <boost/detail/lightweight_test_report.hpp>
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
int test_main(int, char*[]) // note name
{
BOOST_TEST(2 + 2 == 5); // one convertible-to-bool argument
BOOST_TEST_EQ(4 + 4, 9); // two EqualityComparible arguments
BOOST_TEST(fs::exists(".")); // should pass, so nothing reported
return ::boost::report_errors(); // required
}
// Copyright Beman Dawes 2014
// Distributed under the Boost Software License, Version 1.0.
// www.boost.org/LICENSE_1_0.txt

View File

@@ -0,0 +1,13 @@
<html>
<head>
<meta http-equiv="refresh" content="0; URL=../doc/issue_reporting.html">
</head>
<body>
Automatic redirection failed, please go to
<a href="../doc/issue_reporting.html">../doc/issue_reporting.html</a>.
<hr>
<p>&copy; Copyright Beman Dawes, 2014</p>
<p> Distributed under the Boost Software License, Version 1.0.
See http://www.boost.org/LICENSE_1_0.txt</p>
</body>
</html>

View File

@@ -0,0 +1,42 @@
# Boost Filesystem Library Build Jamfile
# (C) Copyright Beman Dawes 2002-2006
# Distributed under the Boost Software License, Version 1.0.
# See www.boost.org/LICENSE_1_0.txt
# See library home page at http://www.boost.org/libs/filesystem
project boost/filesystem
: requirements <host-os>hpux,<toolset>gcc:<define>_INCLUDE_STDC__SOURCE_199901
: source-location ../src
: usage-requirements # pass these requirement to dependents (i.e. users)
<link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
<link>static:<define>BOOST_FILESYSTEM_STATIC_LINK=1
;
SOURCES =
codecvt_error_category
operations
path
path_traits
portability
unique_path
utf8_codecvt_facet
windows_file_codecvt
;
lib boost_filesystem
: $(SOURCES).cpp ../../system/build//boost_system
: <link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
<link>static:<define>BOOST_FILESYSTEM_STATIC_LINK=1
:
: # 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 ;

View File

@@ -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>. ;

View File

@@ -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.

View File

@@ -0,0 +1,7 @@
@echo off
copy /y tutorial.html tutorial.bak
html_include_files +# tutorial.bak tutorial.html
tutorial.html
rem Copyright Beman Dawes 2015
rem Distributed under the Boost Software License, Version 1.0.
rem See http://www.boost.org/LICENSE_1_0.txt

View File

@@ -0,0 +1,387 @@
<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=utf-8">
<title>Filesystem Deprecated Features</title>
<link href="styles.css" rel="stylesheet">
</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">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</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, &#10004; 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">
&#10004;</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">&#10004;</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">
&nbsp;</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">
&#10004;</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">
&#10004;</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">
&#10004;</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">&#10004;</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">&#10004;</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">&#10004;</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">&#10004;</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">&#10004;</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">&#10004;</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">&#10004;</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">&#10004;</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">
&#10004;</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">
&#10004;</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">
&#10004;</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&amp; str, name_check)</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</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,&nbsp; name_check)</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</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">
&#10004;</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&lt;class String, class Traits&gt;<br>
&nbsp; class basic_path;</code></td>
<td style="font-size: 10pt" valign="top">
&nbsp;</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&lt;std::string, path_traits&gt; path</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</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&lt;std::wstring, wpath_traits&gt; wpath</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</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">
&#10004;</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 &lt;class Path&gt;<br>
Path complete(const Path&amp; p,<br>
&nbsp;const Path&amp; base=<br>
&nbsp;&nbsp; initial_path&lt;Path&gt;())</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<p dir="ltr"><code>path absolute(const path&amp; p, const path&amp; base=<br>
&nbsp; 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">
&#10004;</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&amp; ph)</code></td>
<td style="font-size: 10pt" valign="top">
&nbsp;</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">
&#10004;</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">
&#10004;</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">
&#10004;</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">
&nbsp;</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">
&nbsp;</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">
&nbsp;</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">
&nbsp;</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.&nbsp; 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 -->29 December, 2014<!--webbot bot="Timestamp" endspan i-checksum="38652" --></p>
<p>&copy; 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>

View File

@@ -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=utf-8">
<title>Boost Filesystem Library Design</title>
<link href="styles.css" rel="stylesheet">
</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.&nbsp; Scripts were written in
Python, Perl, Bash, and Windows command languages.&nbsp; 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.&nbsp; The need is particularly acute
when C++ is the only toolset allowed in the tool chain.&nbsp; File system
operations are provided by many languages&nbsp;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>
&nbsp;</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>
&nbsp;</li>
<li>Avoid dangerous programming practices. Particularly, all-too-easy-to-ignore error notifications
and use of global variables.&nbsp;If a dangerous feature is provided, identify it as such.<br>
<br>
Rationale: Normally this would be covered by &quot;the usual Boost requirements...&quot;,
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 &quot;current
working directory&quot;.<br>
&nbsp;</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.&nbsp; 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.&nbsp; 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.&nbsp;
Thus the need to interface smoothly with standard library I/O.<br>
&nbsp;</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>
&nbsp;</li>
<li>The usual Boost <a href="http://www.boost.org/more/lib_guide.htm">requirements and
guidelines</a> apply.<br>
&nbsp;</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>
&nbsp;</li>
<li>Avoid giving the illusion of portability where portability in fact does not
exist.<br>
<br>
Rationale: Leaving important behavior unspecified or &quot;implementation defined&quot; 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>
&nbsp;</li>
<li>Some file systems provide both a long and short form of filenames.<br>
&nbsp;</li>
<li>Some file systems have different syntax for file paths and directory
paths.<br>
&nbsp;</li>
<li>Some file systems have different rules for valid file names and valid
directory names.<br>
&nbsp;</li>
<li>Some file systems (ISO-9660, level 1, for example) use very restricted
(so-called 8.3) file names.<br>
&nbsp;</li>
<li>Some operating systems allow file systems with different
characteristics to be &quot;mounted&quot; within a directory tree.&nbsp; Thus a
ISO-9660 or Windows
file system may end up as a sub-tree of a POSIX directory tree.<br>
&nbsp;</li>
<li>Wide-character versions of directory and file operations are available on some operating
systems, and not available on others.<br>
&nbsp;</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>
&nbsp;</li>
<li>Some file systems have a concept of file &quot;version number&quot; or &quot;generation
number&quot;.&nbsp; Some don't.<br>
&nbsp;</li>
<li>Not all operating systems use single character separators in path names.&nbsp; Some use
paired notations. A typical fully-specified OpenVMS filename
might look something like this:<br>
<br>
<code>&nbsp;&nbsp; DISK$SCRATCH:[GEORGE.PROJECT1.DAT]BIG_DATA_FILE.NTP;5<br>
</code><br>
The general OpenVMS format is:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;
<i>Device:[directories.dot.separated]filename.extension;version_number</i><br>
&nbsp;</li>
<li>For common file systems, determining if two descriptors are for same
entity is extremely difficult or impossible.&nbsp; 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>
&nbsp;</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.&nbsp; 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.&nbsp;For example:<br>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp; assert( exists(&quot;foo&quot;) == exists(&quot;foo&quot;) );
// may fail!<br>
&nbsp;&nbsp;&nbsp;&nbsp; assert( is_directory(&quot;foo&quot;) == is_directory(&quot;foo&quot;);
// may fail!<br>
</code><br>
In the first example, the file may have been deleted between calls to
exists().&nbsp; 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>
&nbsp;</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>
&nbsp;</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>&nbsp; pointing to <code>b/c</code>,
then under POSIX Pathname Resolution rules a path of <code>&quot;/a/x/..&quot;</code>
should resolve to <code>&quot;/a/b&quot;</code>. If <code>&quot;/a/x/..&quot;</code> were first
normalized to <code>&quot;/a&quot;</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.&nbsp; 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( &quot;foo&quot;
)</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&lt;string&gt;</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.&nbsp;
Rather, the programmer must think out the question &quot;What operating systems do I
want this path to be portable to?&quot;&nbsp; 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.&nbsp; Some with
operations functions.&nbsp; 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,&nbsp; is much simpler and straightforward, although it does depend to
some extent on programmer discipline.&nbsp; 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&nbsp;Std&nbsp;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"><EFBFBD> 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 -->26 December, 2014<!--webbot bot="Timestamp" endspan i-checksum="38646" --></p>
<p>&copy; 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>

View File

@@ -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=utf-8">
<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() : ... &amp;&amp; (name is &quot;.&quot; or &quot;..&quot;, and the first character
not a period or hyphen)
portable_directory_name(): ... &amp;&amp; (name is &quot;.&quot; or &quot;..&quot; &nbsp;or contains no periods)
Should portable_name() be &quot;... &amp;&amp; (name is &quot;.&quot; or &quot;..&quot;, or contains no
periods) &amp;&amp; (first character not a hyphen)&quot;? &nbsp;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. &nbsp;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. &nbsp;With this functionality,
preconditions requiring absolute paths would be less onerous.
&nbsp; &nbsp;Precondition: p.is_absolute() &amp;&amp; base.is_absolute()
&nbsp; &nbsp;Effects: Extracts a path, rp, from p relative to base such that
canonical(p) == complete(rp, base). &nbsp;Any &quot;..&quot; path elements in rp form
a prefix.
&nbsp; &nbsp;Returns: The extracted path.
&nbsp; &nbsp;Postconditions: For the returned path, rp, rp.is_relative() ==
(p.root_name() == b.root_name()).
[Notes: This function simplifies paths by omitting context. &nbsp;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. &nbsp;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. &nbsp;The simplest implementation uses canonical to expand both p and
base, then removes the common prefix and prepends the requisite &quot;..&quot;
elements. &nbsp;Smarter implementations will avoid expanding symlinks
unnecessarily. &nbsp;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 &lt;-- 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 &quot;using
namespace boost::filesystem&quot;<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>&copy; 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>

View File

@@ -0,0 +1,148 @@
<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=utf-8">
<title>Filesystem FAQ</title>
<link href="styles.css" rel="stylesheet">
</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">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<h1>
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.&nbsp;Features specific to a particular operating system or file system
can always be accessed by using the operating system's API.</p>
<h2>
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.&nbsp; 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.&nbsp; Thus for the primary &quot;portable script-style file system
operations&quot; 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?&nbsp; 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&amp; 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 &quot;portable script-style
file system operations&quot; 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.&nbsp;&nbsp;&nbsp; </p>
<p>The case for the &quot;handle&quot; (opaque data type to identify a file)
style may be strongest for directory iterator value type.&nbsp; (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.&nbsp;
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.&nbsp; OTOH, the specific functionality needed for several trial
applications was very easy for the user to construct from the lower-level
toolkit functions.&nbsp; 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 &quot;read-only&quot; turned out to be so
system depend as to be disqualified as a &quot;guaranteed presence&quot; 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.&nbsp;
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 -->29 December, 2014<!--webbot bot="Timestamp" endspan i-checksum="38652" --></p>
<p>&copy; 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>

View File

@@ -0,0 +1,475 @@
<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=utf-8">
<title>Filesystem Home</title>
<link href="styles.css" rel="stylesheet">
</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">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports</a>&nbsp;&nbsp;
</td>
</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>
&nbsp; with acknowledgements</a></td>
</tr>
</table>
<p></p>
<div align="center">
<center>
<table border="1" cellpadding="10" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td>
<p align="left">This is Version 3 of the Filesystem library. Version 2 is
not longer supported. 1.49.0 was the last release of Boost to supply
Version 2</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>
&nbsp;<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>
&nbsp;</li>
</ul>
</li>
<li><b>Error handling and reporting via C++ exceptions (the default) or error
codes.</b><br>
&nbsp;<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>
&nbsp;</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>
&nbsp;<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( &quot;foo&quot; ) == exists( &quot;foo&quot; ) );&nbsp; //
(1)<br>
<br>
remove_all( &quot;foo&quot; );<br>
assert( !exists( &quot;foo&quot; ) );&nbsp; // (2)<br>
<br>
assert( is_directory( &quot;foo&quot; ) == is_directory( &quot;foo&quot; ) ); //
(3)</code></p>
</blockquote>
<p>(1) will fail if a non-existent &quot;foo&quot; comes into existence, or an
existent &quot;foo&quot; 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 &quot;foo&quot; is created by another
thread, process, or computer.</p>
<p>(3) will fail if another thread, process, or computer removes an
existing file &quot;foo&quot; and then creates a directory named &quot;foo&quot;, 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 &quot;Throws&quot; 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&nbsp;headers:</p>
<ul>
<li>Header &lt;<a href="../../../boost/filesystem.hpp">boost/filesystem.hpp</a>&gt;
provides access to all features of the library, except file streams.<br>
&nbsp;</li>
<li>Header &lt;<a href="../../../boost/filesystem/fstream.hpp">boost/filesystem<i>/</i>fstream.hpp</a>&gt;
inherits the same components as the C++ Standard
Library's <i>fstream</i> header, but files are identified by <code>const path&amp;</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.&nbsp; 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 4</h3>
<p><b>Under development </b>- Add support for the
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4099.html">ISO
C++ File System Technical Specification</a>. The Filesystem TS is based on
Boost.Filesystem Version 3, with only a small number of changes. Most user code
written for Version 3 should work unchanged with Version 4.</p>
<h3>Version 3</h3>
<p>Boost 1.44.0 - June, 2010 - 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 &quot;illusion
of portability&quot; 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.&nbsp;</p>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->10 January, 2015<!--webbot bot="Timestamp" endspan i-checksum="38885" --></p>
<p>&copy; 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>

View File

@@ -0,0 +1,224 @@
<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=utf-8">
<title>Filesystem issue reporting</title>
<link href="styles.css" rel="stylesheet">
</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 Bug Reporting</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">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<p>Boost.Filesystem issues such as bug reports or feature requests should be
reported via a <a href="https://svn.boost.org/trac/boost/newticket">Boost Trac ticket</a>.</p>
<p><a href="https://github.com/boostorg/filesystem/pulls">GitHub pull requests</a>
are encouraged, too, although anything beyond really trivial fixes needs a trac
ticket.</p>
<h3>Bug reports</h3>
<p>A timely response to your bug report is much more likely if <b>the problem can
be immediately reproduced without guesswork and regression tests can be easily
created</b>. </p>
<p>You need to provide the following:</p>
<ol>
<li>A simple test program
that:<ul>
<li>Illustrates the problem, and</li>
<li>Automatically yields an unambiguous pass or fail result - returning zero
for pass and non-zero for fail is preferred, and </li>
<li>Can be used as the basis for adding tests to Boost.Filesystem&#39;s
regression test suite.</li>
</ul>
</li>
<li>The compiler, standard library, platform, and Boost version you
used to build and run your test program.</li>
<li>A description of how to build and run the test program.
</li>
<li>A copy of the output from the test
program, if any.</li>
<li>An email address for follow-up questions.</li>
</ol>
<p>See <a href="#Rationale">Rationale</a> to find out why the above is needed.</p>
<p>For a mostly automatic framework to provide the above, read on!</p>
<h3>Bug reporting framework</h3>
<p>The directory <code>&lt;boost-root&gt;/libs/filesystem/bug&gt;</code> provides a bug test program (<code><a href="#bug-cpp">bug.cpp</a></code>)
and a build file (<code>Jamfile.v2</code>). Here is what you need to do:</p>
<ol>
<li>Add one or more test cases to <code><a href="#bug-cpp">bug.cpp</a></code>
using any text or program editor.</li>
<li><a href="#Build-and-test">Build and test</a>.</li>
<li>Attach copies of the <a href="#Test-output">Test output</a> and test
program to the <a href="https://svn.boost.org/trac/boost/newticket">Trac
ticket</a>.</li>
</ol>
<p>That&#39;s it! When you complete those steps, you will be done!</p>
<p>The test output supplies all of the basic information about the compiler, std
library, platform, Boost version, and command line, and the test cases you have
added should make it easy for the library maintainer to reproduce the problem. </p>
<h3>Using the framework</h3>
<h4><a name="bug-cpp"><code>bug.cpp</code></a></h4>
<p>Here is <code>bug.cpp</code> as supplied. To report a real bug, use
<code>BOOST_TEST</code> and <code>BOOST_TEST_EQ</code> macros to build your own
test cases. You can delete the three tests already in <code>bug.cpp</code>:</p>
<blockquote>
<pre>#include &lt;boost/detail/lightweight_test_report.hpp&gt;
#include &lt;boost/filesystem.hpp&gt;
namespace fs = boost::filesystem;
int test_main(int, char*[]) // note name
{
BOOST_TEST(2 + 2 == 5); // one convertible-to-bool argument; this one fails!
BOOST_TEST_EQ(4 + 4, 9); // two EqualityComparible arguments; this one fails!
BOOST_TEST(fs::exists(".")); // should pass, so nothing should be reported
return ::boost::report_errors(); // required
}
</pre>
</blockquote>
<h4><a name="Build-and-test">Build and test</a></h4>
<p>POSIX-like systems:</p>
<blockquote>
<pre>cd &lt;boost-root&gt;/libs/filesystem/bug
../../../b2 -a
bin/bug</pre>
</blockquote>
<p>Windows:</p>
<blockquote>
<pre>cd &lt;boost-root&gt;\libs\filesystem\bug
..\..\..\b2 -a
bin\bug</pre>
</blockquote>
<h4><a name="Test-output">Test output</a></h4>
<p>Running the test on Windows produced this test output:</p>
<blockquote>
<pre>Microsoft Visual C++ version 14.0
Dinkumware standard library version 610
Win32
Boost version 1.58.0
Command line: bin\bug
bug.cpp(10): test '2 + 2 == 5' failed in function
'int __cdecl test_main(int,char *[])'
bug.cpp(11): test '4 + 4 == 9' failed in function
'int __cdecl test_main(int,char *[])': '8' != '9'
2 errors detected.</pre>
</blockquote>
<p>The test framework runs <code>test_main()</code> from a <code>try</code>
block with a <code>catch</code> block that reports exceptions via <code>
std::exception what()</code>. So the output will differ if an exception is
thrown.</p>
<h2>Background information</h2>
<p>You should now have enough information to file an easy-to-reproduce bug
report. So you can skip reading the rest of this page unless you need to do
something a bit out of the ordinary.</p>
<h3><a name="b2-command-line-options"><code>b2</code> command line</a></h3>
<p><code>b2</code> (formerly <code>bjam</code>) usage:&nbsp; <code>b2
[options] [properties] [target]</code></p>
<p>Boost.Build b2 has many options, properties, and targets, but you will not
need most of them for bug reporting. Here are a few you might find helpful:</p>
<p><b>Options</b></p>
<blockquote>
<p><code>-a</code>&nbsp;&nbsp;&nbsp; Rebuild everything rather than
just out-of-date targets. Used in the example build above to ensure libraries
are built with the same setup as the test program.</p>
</blockquote>
<p><b>Properties</b></p>
<blockquote>
<p><code>address-model=<i>n&nbsp; n</i></code> is 32 or 64.
Explicitly request either 32-bit or 64-bit code generation. This typically
requires that your compiler is appropriately configured.</p>
<p><code>variant=</code><i>string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string </i>is
<code>debug</code> or <code>release</code>.</p>
<p><code>toolset=</code><i>string</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The C++
compiler to use. For example, <code>gcc-4.9</code>, <code>clang-3.3</code>,
<code>or msvc-14.0</code>.</p>
<p><code>include=</code><i>string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </i>
Additional include paths for C and C++ compilers.</p>
<p><code>cxxflags=</code><i>string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </i>
Custom options to pass to the C++ compiler.</p>
<p><code>define=</code><i>string</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Additional macro definitions for C and C++ compilers. <i>string</i> should be
either <code class="computeroutput">SYMBOL</code> or
<code class="computeroutput">SYMBOL=VALUE</code></p>
</blockquote>
<h3><a name="Rationale">Rationale</a></h3>
<p>Here is the request list again, with rationale added:</p>
<ol>
<li>A simple test program
that:<ul>
<li dir="ltr">
<p dir="ltr">Illustrates the problem <b>[Code communicates more clearly than
prose. If it looks like it will it will take some time to figure out exactly what the
problem is, or worse yet, might result in a wild-goose chase, the bug report
gets set aside to be worked on later and then is often forgotten.] </b>and</li>
<li>Automatically yields an unambiguous pass or fail result - returning zero
for pass and non-zero for fail is preferred <b>[Prevents
miscommunications and allows use in automatic regression tests.]</b>, and </li>
<li>Can be used as the basis for adding tests to Boost.Filesystem&#39;s
regression test suite <b>[With good test cases fixes come easier and
regressions become less likely]</b>.</li>
</ul>
</li>
<li>The compiler, standard library, platform, and Boost version you
used to build and run your test program. <b>[The implementation includes much
platform dependent code, and also depends on the other factors mentioned. Know
these things upfront brings the bug report into focus without having to ask
for more information. ]</b></li>
<li>A description of how to build and run the test program. <b>[If b2
(formerly known as bjam) is used as the build engine, this is not a concern,
but otherwise much more information is needed.]</b></li>
<li>A copy of the output from the test
program, if any. <b>[Avoids misinterpreting results.]</b></li>
<li>An email address for follow-up questions.<b> [Trac comments are the
primary means of response, but it is disheartening when a trac question is not
answered and there is no email address attached for followup.]</b></li>
</ol>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->28 January, 2015<!--webbot bot="Timestamp" endspan i-checksum="38902" --></p>
<p>&copy; Copyright Beman Dawes, 2014</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>

View File

@@ -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;
}

View File

@@ -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

View File

@@ -0,0 +1,242 @@
<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=utf-8">
<title>Portability Guide</title>
<link href="styles.css" rel="stylesheet">
</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">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<p>
<a href="#Introduction">Introduction</a><br>
<a href="#name_check<63>_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.&nbsp;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 &quot;fighting chance&quot; to achieve portability by early
detection of common naming problems.</p>
<h2><a name="name_check<63>_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&amp;<i> name</i>)</code></td>
<td><b>Returns:</b> <i>true</i> if <code>!name.empty() &amp;&amp; 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&amp;<i> name</i>)</code></td>
<td><b>Returns:</b>&nbsp; <i>true</i> if <code>!name.empty() &amp;&amp; name</code> contains
only the characters specified by the Windows platform SDK as valid
regardless of the file system <code>&amp;&amp; (name</code> is <code>&quot;.&quot;</code> or
<code>&quot;..&quot;</code>&nbsp; or does not end with a trailing space or period<code>)</code>.&nbsp;
The allowed characters are anything except <code>0x0-0x1F</code>, <code>'&lt;'</code>,
<code>'&gt;'</code>, <code>':'</code>, <code>'&quot;'</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&amp;<i> name</i>)</code></td>
<td><b>Returns:</b> <code>&nbsp;windows_name(name) &amp;&amp; portable_posix_name(name)
&amp;&amp; (name</code> is <code>&quot;.&quot;</code> or <code>&quot;..&quot;</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&amp;<i> name</i>)</code></td>
<td><b>Returns:</b> <code>portable_name(name) &amp;&amp; (name</code> is <code>&quot;.&quot;</code>
or <code>&quot;..&quot;</code>&nbsp; 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&amp;<i> name</i>)</code></td>
<td><b>Returns:</b> <code>portable_name(name) &amp;&amp; </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 &quot;file extension&quot;
but limit its length.</td>
</tr>
<tr>
<td align="left" valign="top"><code><a name="native">native</a>(const
std::string&amp;<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 &quot;portable_&quot; <a href="#name_check<63>_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 &quot;Foo&quot; and &quot;foo&quot;. </td>
<td valign="top">Some file systems are case insensitive.&nbsp; 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.&nbsp; For example, do not expect a file
created with the name of &quot;Foo&quot; to be opened successfully with the name of &quot;foo&quot;.</td>
<td valign="top">Some file systems are case sensitive.&nbsp; 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.&nbsp;
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.&nbsp; 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.&nbsp; Pick the specific limit according to
the operating systems and or file systems you wish portability to:<br>
&nbsp;&nbsp; Not a concern::&nbsp; POSIX, Windows, MAC OS X.<br>
&nbsp;&nbsp; 31 characters: Classic Mac OS<br>
&nbsp;&nbsp; 8 characters + period + 3 characters: ISO 9660 level 1<br>
&nbsp;&nbsp; 32 characters: ISO 9660 level 2 and 3<br>
&nbsp;&nbsp; 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 -->29 December, 2014<!--webbot bot="Timestamp" endspan i-checksum="38652" --></p>
<p>&copy; 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>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,284 @@
<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=utf-8">
<title>Filesystem Release History</title>
<link href="styles.css" rel="stylesheet">
</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">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<h2>1.58.0</h2>
<ul>
<li>Rewrite Windows implementation of temp_directory_path() to (1) avoid
GetTempPath() failure if path length &gt; 130 (ticket #5300) and (2) provide a
more sensible sequence of directories than provided by GetTempPath(), per
boost list discussion &quot;[filesystem] temp_directory_path() behavior on
Windows&quot;. The new sequence is:<ol>
<li><i><code>%TMP%</code></i></li>
<li><i><code>%TEMP%</code></i></li>
<li><code><i>%LOCALAPPDATA%</i>/Temp</code></li>
<li><code><i>%USERPROFILE%</i>/Temp</code></li>
<li><code><i>GetWindowsDirectoryW()</i>/Temp</code></li>
</ol>
</li>
</ul>
<h2>1.57.0</h2>
<ul>
<li>Rework class <code>path</code> locale and codecvt implementation for increased reliability.
This change was SVN revision 83021, which should have gone into 1.56.0 but
unfortunately the merge didn't happen until too late.</li>
<li>Fix tickets <a href="https://svn.boost.org/trac/boost/ticket/8930">#8930</a>, <a href="https://svn.boost.org/trac/boost/ticket/9054">#9054</a>,
<a href="https://svn.boost.org/trac/boost/ticket/9214">#9219</a>,
<a href="https://svn.boost.org/trac/boost/ticket/10228">#10228</a>, and
<a href="https://svn.boost.org/trac/boost/ticket/10641">#10641</a>, all
related to locales and codecvt facets.</li>
<li>The net effect of the above changes and fixes should be to eliminate
spurious &quot;locale::facet::_S_create_c_locale name not valid&quot; errors on Linux
and other non-BSD POSIX-like systems. The error will continue to occur, as it
should, when a path encoding conversion char-to-wchar_t or wchar_t-to-char is
attempted in an environment without a valid C locale (for example, if the LANG
environment variable is invalid or not defined).</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/6124">#6124</a>,
<a href="https://svn.boost.org/trac/boost/ticket/6779">#6779</a>, and
<a href="https://svn.boost.org/trac/boost/ticket/10038">#10038</a> - an
undefined reference that occurred when the library was compiled for C++03 but
the using program was compiled for C++11, or vice versa. The private library
interface has been changed to use a plain-old C++03 enum. This is the fix
suggested by Andy in 6779.</li>
<li>The Windows implementation now treats NTFS directory junctions (also known
as junctions, also known as mount points) as symlinks. This has the effect of
treating directory junctions as directories, and thus supporting all
operations suitable for directories. This resolves
<a href="https://svn.boost.org/trac/boost/ticket/9016">#9016</a>. Directory
junctions are very similar to symlinks, but may have performance or other
advantages in some situations. They can be created from the command line with
&quot;<code>mklink /j link target</code>&quot;. There is no plan for Boost.Filesystem to
be able to create them directly other than by calling <code>std::system()</code>.</li>
</ul>
<h2>1.56.0</h2>
<ul>
<li>Reorganize <code>recursive_directory_iterator::increment</code>, adding an
invariant that progress is always made, even if an error is reported by
exception or error_code. Add a manually executed test, <code>
test/issues/recurse_dir_iter_5403.cpp</code>. Adjust regular regression tests
as needed. Thanks to Claudio Bley for the
<a href="https://github.com/boostorg/filesystem/pull/4">pull request</a> - the
change was incorporated into the reorganized code. Fixes
<a href="https://svn.boost.org/trac/boost/ticket/5403">#5403</a> and
<a href="https://svn.boost.org/trac/boost/ticket/6821">#6821</a>.</li>
<li>Fix <code>canonical()</code> to treat parent of root as root. (Christian
Hammerl) Fixes <a href="https://svn.boost.org/trac/boost/ticket/9683">#9683</a>
and <a href="https://svn.boost.org/trac/boost/ticket/10187">#10187</a>.</li>
<li>Added missing test for <code>__sun</code> macro which is defined on
Solaris 10. (Chris Stylianou)</li>
<li>Minor fixes and code cleanup.</li>
<li>Update IDE projects to Visual Studio 2013.</li>
<li>Remove unused <code>const char colon</code> to clear clang warning. (J?gen
Hunold)</li>
<li>Add BOOST_NOEXCEPT to <code>class filesystem_error</code>.</li>
<li>Change <code>perms::all_all</code> and <code>perms::perms_mask</code> to
absolute values to quiet intellisense warnings, and conform to C++11.</li>
</ul>
<h2>1.54.0</h2>
<ul>
<li>Reimplement <code>path::codecvt()</code> and <code>path::imbue()</code>
with portable code that is intended to be much more robust and maintainable. A
section on <a href="reference.html#path-Usage">path usage concerns</a> has
been added to the reference documentation describing several concerns that
arise in the context of multithreading and <code>path::codecvt()</code>.</li>
</ul>
<h2>1.52.0</h2>
<ul>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/7239">#7239</a>, Stack
overflow when calling <code>create_directories(&quot;:D&quot;)</code>. The reported
problem was a symptom of an internal bug that caused <code>path::filename()</code>
and <code>path::parent_path()</code> to fail on Windows for <code>path(&quot;:&quot;)</code>,
and that in turn caused other functions that depend on <code>filename()</code>
or <code>parent_path()</code> to fail, such as <code>create_directories()</code>.</li>
</ul>
<h2>1.51.0</h2>
<ul>
<li>Add begin() and end() non-member functions for directory_iterator and
recursive_directory_iterator so that C++11 range-based for statements work.
Suggested by feature requests
<a href="https://svn.boost.org/trac/boost/ticket/5896">#5896</a> and
<a href="https://svn.boost.org/trac/boost/ticket/6521">#6521</a>, using the
<a href="https://svn.boost.org/trac/boost/ticket/5896">#5896</a> approach.</li>
<li>Add range_begin() and range_end() non-member functions for directory_iterator and
recursive_directory_iterator so that
<a href="http://www.boost.org/libs/foreach/">BOOST_FOREACH</a> works.</li>
<li>Fix a Linux fchmodat problem affecting symlink permissions reported during
discussion of <a href="https://svn.boost.org/trac/boost/ticket/6659">#6659</a>.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/6659">#6659</a> and
<a href="https://svn.boost.org/trac/boost/ticket/7051">#7051</a>, fchmodat
supported only on Solaris 11. Fix for both Sun and GCC compilers. </li>
</ul>
<h2>1.50.0</h2>
<ul>
<li>Remove Filesystem Version 2 from the distribution. Version 3 is now the
only distributed version. Those still using V2 are urged to migrate to V3 as
soon as possible.</li>
<li>Add <code>constexpr value_type preferred_separator</code> to class path.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5118">#5118</a>,
<code>replace_extension</code> doesn't work as specified in documentation. The
documentation, implementation, and test cases have all had fixes applied. The
documentation had failed to mention that any existing extension is removed.
The behavior for simple cases has been reverted to the Version 2 behavior, but
with corrections so that complex replacements now work. Two test cases from
#5118 have been added.</li>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/3737">#3737</a>,
Boost.Filesystem does not compile on Windows Mobile. On Windows, &lt;sys/stat.h&gt;
is no longer included.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/4065">#4065</a>,
Boost Filesystem lexicographic path comparison inconsistent. This required
multiple source code bug fixes and code cleanup, correcting problems not
related to lexicographical issues.</li>
<li>Add class path member function <code>compare</code> for consistency with
std::string.</li>
<li>Tighten BOOST_FILESYSTEM_DYN_LINK and BOOST_FILESYSTEM_STATIC_LINK logic
in filesystem/config.hpp so that one or the other is always defined, and both
being defined is a #error.</li>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/6690">#6690</a> and
<a href="http://svn.boost.org/trac/boost/ticket/6737">#6737</a>, resolving
static linking related problems with VC++ 8 through 11. Note that this fix may
reintroduce codecvt thread safety problems
<a href="http://svn.boost.org/trac/boost/ticket/4889">#4889</a>,
<a href="http://svn.boost.org/trac/boost/ticket/6320">#6320</a>, for these
compilers if static linking is used.</li>
<li>Add path::operator+= and concat functions to tack on things like suffixes
or numbers. Suggested by Ed Smith-Rowland and others.</li>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/6809">#6809</a>,
Implementation of filesystem::rename() method for MS Windows is wrong, by
adding MOVEFILE_COPY_ALLOWED to deal with renames across drives, volumes, file
systems. Fix has no effect on non-Windows systems.</li>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/6819">#6819</a>, A path operand with a source that was a one character array was
treated as empty, even if it wasn't empty. Such arrays can occur in unions or
in code using C variable length array idioms.</li>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/6932">#6932</a>,
create_directories throws exception even if error_code is specified.</li>
</ul>
<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(&quot;&quot;) 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(&quot;&quot;) exception being thrown before main() starts on
poorly configured (e.g. LANG=&quot;bad name&quot;) 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.&nbsp; Run &quot;bjam&quot; (NOT &quot;bjam install&quot;) 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 &lt;boost/config/user.hpp&gt; 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 -->03 February, 2015<!--webbot bot="Timestamp" endspan i-checksum="40532" --></p>
<p>&copy; 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>

View File

@@ -0,0 +1,19 @@
body
{
font-family: arial, sans-serif;
max-width: 6.5in;
margin: 0px auto;
font-size: 85%;
}
ins {background-color: #CCFFCC;}
del {background-color: #FFCACA;}
pre {background-color: #D7EEFF; font-size: 95%; font-family: "courier new", courier, serif;}
code {font-size: 110%; font-family: "courier new", courier, serif;}
table {font-size: 100%;}
/*
<20> Copyright Beman Dawes, 2014
Distributed under the Boost Software License, Version 1.0.
See www.boost.org/LICENSE_1_0.txt
*/

View File

@@ -0,0 +1,52 @@
<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=utf-8">
<title>Filesystem Tickets</title>
</head>
<body>
<p>&nbsp;</p>
<h2>Locale related</h2>
<p><a href="https://svn.boost.org/trac/boost/ticket/3332">#3332</a>
boost::filesystem::path will get trobule in locale Chinese_Taiwan.950 (windows)<br>
<a href="https://svn.boost.org/trac/boost/ticket/7211">#7211</a> path_locale
destructor crashes when overloaded operator new and delete are present<br>
<a href="https://svn.boost.org/trac/boost/ticket/8388">#8388</a>
windows_file_codecvt should be allocated with _NEW_CRT<br>
<a href="https://svn.boost.org/trac/boost/ticket/8642">#8642</a> Global locale
prevents from using Boost.Filesystem in global constructors and destructors<br>
<a href="https://svn.boost.org/trac/boost/ticket/8930">#8930</a>
boost::path::root_directory() throws locale::facet::_S_create_c_locale name not
valid<br>
<a href="https://svn.boost.org/trac/boost/ticket/9182">#9182</a>
Boost-filesystem std::runtime_error: locale::facet::_S_create_c_locale name not
valid failure on Xamarin.Android<br>
<a href="https://svn.boost.org/trac/boost/ticket/9219">#9219</a> path::codecvt()
is called when not required<br>
<a href="https://svn.boost.org/trac/boost/ticket/9560">#9560</a>
operations_test_static unit test crashes during static initialization phase on
Mac/10.7/32-bit/darwin-4.2.1<br>
<a href="https://svn.boost.org/trac/boost/ticket/10205">#10205</a> FileSystem
runtime error: locale::facet::_S_create_c_locale name not valid<br>
<br>
&nbsp;</p>
<h2>TR alignment</h2>
<p>Work has started to bring the library into alignment with the C++ File System
Technical Specification (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4099.html">HTML</a>)
(<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf">PDF</a>).
This work is occurring on the
<a href="https://github.com/boostorg/filesystem/tree/ts-develop">git <code>
ts-develop</code> branch</a>, and is currently very unstable. </p>
<ul>
<li><a href="https://svn.boost.org/trac/boost/ticket/10291">#10291</a> path
doesn't have move constructor/assignment operator.</li>
</ul>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,152 @@
<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=utf-8">
<title>Filesystem V3 Intro</title>
<link href="styles.css" rel="stylesheet">
<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">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</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>
&nbsp;</li>
<li>New <code>class path</code> members include:<br>
&nbsp;<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>
&nbsp;</code></li>
</ul>
</li>
<li>New or improved operations functions include:<br>
&nbsp;<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>
&nbsp;</li>
</ul>
</li>
<li>Support for error reporting via <code>error_code</code> is now uniform
throughout the operations functions.<br>
&nbsp;</li>
<li>Documentation has been reworked, including re-writes of major portions.<br>
&nbsp;</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>
&nbsp;</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>
&nbsp;</li>
<li>&nbsp;<code>path::iterator::value_type</code> and&nbsp; <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>
&nbsp;</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>
&nbsp;</li>
<li>MinGW versions not supporting wide strings are no longer supported.<br>
&nbsp;</li>
<li>Microsoft VC++ 7.1 and earlier are no longer supported.</li>
</ul>
<hr>
<p>&copy; 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 -->29 December 2014<!--webbot bot="Timestamp" endspan i-checksum="39176" --></p>
</body>
</html>

View File

@@ -0,0 +1,199 @@
<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=utf-8">
<title>Filesystem V3 Design</title>
<link href="styles.css" rel="stylesheet">
</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">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</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&lt;class Path&gt;
void foo( const Path &amp; p );</pre>
<pre>inline void foo( const path &amp; p )
{
return foo&lt;path&gt;( p );
}
inline void foo( const wpath &amp; p )
{
return foo&lt;wpath&gt;( 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 &amp; 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 -->29 December, 2014<!--webbot bot="Timestamp" endspan i-checksum="38652" --></p>
<p>&copy; 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>

View File

@@ -0,0 +1,26 @@
# 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 ;
exe file_size : file_size.cpp ;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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; };
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\..\..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>..\..\..\..\..\stage\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

View File

@@ -0,0 +1,78 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut1", "tut1\tut1.vcxproj", "{04A56B6F-9901-4F6D-8936-9554A44E0DD6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut2", "tut2\tut2.vcxproj", "{BA9220FA-FECF-4B28-80A0-7F5017524EB5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut3", "tut3\tut3.vcxproj", "{747CF49E-27D8-4C5E-BB46-25779FD8DDEB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut4", "tut4\tut4.vcxproj", "{50FB30B4-F088-44E3-81BB-0C9CA65693CB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut5", "tut5\tut5.vcxproj", "{F17107D6-32E8-40EA-89A2-83BA9BA44A56}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "path_info", "path_info\path_info.vcxproj", "{A37B7F28-3261-41BF-8BC1-8384BD4C8E47}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{04A56B6F-9901-4F6D-8936-9554A44E0DD6}.Debug|x64.ActiveCfg = Debug|x64
{04A56B6F-9901-4F6D-8936-9554A44E0DD6}.Debug|x64.Build.0 = Debug|x64
{04A56B6F-9901-4F6D-8936-9554A44E0DD6}.Debug|x86.ActiveCfg = Debug|Win32
{04A56B6F-9901-4F6D-8936-9554A44E0DD6}.Debug|x86.Build.0 = Debug|Win32
{04A56B6F-9901-4F6D-8936-9554A44E0DD6}.Release|x64.ActiveCfg = Release|x64
{04A56B6F-9901-4F6D-8936-9554A44E0DD6}.Release|x64.Build.0 = Release|x64
{04A56B6F-9901-4F6D-8936-9554A44E0DD6}.Release|x86.ActiveCfg = Release|Win32
{04A56B6F-9901-4F6D-8936-9554A44E0DD6}.Release|x86.Build.0 = Release|Win32
{BA9220FA-FECF-4B28-80A0-7F5017524EB5}.Debug|x64.ActiveCfg = Debug|x64
{BA9220FA-FECF-4B28-80A0-7F5017524EB5}.Debug|x64.Build.0 = Debug|x64
{BA9220FA-FECF-4B28-80A0-7F5017524EB5}.Debug|x86.ActiveCfg = Debug|Win32
{BA9220FA-FECF-4B28-80A0-7F5017524EB5}.Debug|x86.Build.0 = Debug|Win32
{BA9220FA-FECF-4B28-80A0-7F5017524EB5}.Release|x64.ActiveCfg = Release|x64
{BA9220FA-FECF-4B28-80A0-7F5017524EB5}.Release|x64.Build.0 = Release|x64
{BA9220FA-FECF-4B28-80A0-7F5017524EB5}.Release|x86.ActiveCfg = Release|Win32
{BA9220FA-FECF-4B28-80A0-7F5017524EB5}.Release|x86.Build.0 = Release|Win32
{747CF49E-27D8-4C5E-BB46-25779FD8DDEB}.Debug|x64.ActiveCfg = Debug|x64
{747CF49E-27D8-4C5E-BB46-25779FD8DDEB}.Debug|x64.Build.0 = Debug|x64
{747CF49E-27D8-4C5E-BB46-25779FD8DDEB}.Debug|x86.ActiveCfg = Debug|Win32
{747CF49E-27D8-4C5E-BB46-25779FD8DDEB}.Debug|x86.Build.0 = Debug|Win32
{747CF49E-27D8-4C5E-BB46-25779FD8DDEB}.Release|x64.ActiveCfg = Release|x64
{747CF49E-27D8-4C5E-BB46-25779FD8DDEB}.Release|x64.Build.0 = Release|x64
{747CF49E-27D8-4C5E-BB46-25779FD8DDEB}.Release|x86.ActiveCfg = Release|Win32
{747CF49E-27D8-4C5E-BB46-25779FD8DDEB}.Release|x86.Build.0 = Release|Win32
{50FB30B4-F088-44E3-81BB-0C9CA65693CB}.Debug|x64.ActiveCfg = Debug|x64
{50FB30B4-F088-44E3-81BB-0C9CA65693CB}.Debug|x64.Build.0 = Debug|x64
{50FB30B4-F088-44E3-81BB-0C9CA65693CB}.Debug|x86.ActiveCfg = Debug|Win32
{50FB30B4-F088-44E3-81BB-0C9CA65693CB}.Debug|x86.Build.0 = Debug|Win32
{50FB30B4-F088-44E3-81BB-0C9CA65693CB}.Release|x64.ActiveCfg = Release|x64
{50FB30B4-F088-44E3-81BB-0C9CA65693CB}.Release|x64.Build.0 = Release|x64
{50FB30B4-F088-44E3-81BB-0C9CA65693CB}.Release|x86.ActiveCfg = Release|Win32
{50FB30B4-F088-44E3-81BB-0C9CA65693CB}.Release|x86.Build.0 = Release|Win32
{F17107D6-32E8-40EA-89A2-83BA9BA44A56}.Debug|x64.ActiveCfg = Debug|x64
{F17107D6-32E8-40EA-89A2-83BA9BA44A56}.Debug|x64.Build.0 = Debug|x64
{F17107D6-32E8-40EA-89A2-83BA9BA44A56}.Debug|x86.ActiveCfg = Debug|Win32
{F17107D6-32E8-40EA-89A2-83BA9BA44A56}.Debug|x86.Build.0 = Debug|Win32
{F17107D6-32E8-40EA-89A2-83BA9BA44A56}.Release|x64.ActiveCfg = Release|x64
{F17107D6-32E8-40EA-89A2-83BA9BA44A56}.Release|x64.Build.0 = Release|x64
{F17107D6-32E8-40EA-89A2-83BA9BA44A56}.Release|x86.ActiveCfg = Release|Win32
{F17107D6-32E8-40EA-89A2-83BA9BA44A56}.Release|x86.Build.0 = Release|Win32
{A37B7F28-3261-41BF-8BC1-8384BD4C8E47}.Debug|x64.ActiveCfg = Debug|x64
{A37B7F28-3261-41BF-8BC1-8384BD4C8E47}.Debug|x64.Build.0 = Debug|x64
{A37B7F28-3261-41BF-8BC1-8384BD4C8E47}.Debug|x86.ActiveCfg = Debug|Win32
{A37B7F28-3261-41BF-8BC1-8384BD4C8E47}.Debug|x86.Build.0 = Debug|Win32
{A37B7F28-3261-41BF-8BC1-8384BD4C8E47}.Release|x64.ActiveCfg = Release|x64
{A37B7F28-3261-41BF-8BC1-8384BD4C8E47}.Release|x64.Build.0 = Release|x64
{A37B7F28-3261-41BF-8BC1-8384BD4C8E47}.Release|x86.ActiveCfg = Release|Win32
{A37B7F28-3261-41BF-8BC1-8384BD4C8E47}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A37B7F28-3261-41BF-8BC1-8384BD4C8E47}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>path_info</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<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|x64'">
<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)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\path_info.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{04A56B6F-9901-4F6D-8936-9554A44E0DD6}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>tut1</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<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|x64'">
<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)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\tut1.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{BA9220FA-FECF-4B28-80A0-7F5017524EB5}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>tut2</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<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|x64'">
<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)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\tut2.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{747CF49E-27D8-4C5E-BB46-25779FD8DDEB}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>tut3</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<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|x64'">
<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)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)\$(TargetName).exe" .</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)\$(TargetName).exe" .</Command>
</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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)\$(TargetName).exe" .</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)\$(TargetName).exe" .</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\tut3.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{50FB30B4-F088-44E3-81BB-0C9CA65693CB}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>tut4</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<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|x64'">
<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)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)\$(TargetName).exe" .</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)\$(TargetName).exe" .</Command>
</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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)\$(TargetName).exe" .</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)\$(TargetName).exe" .</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\tut4.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F17107D6-32E8-40EA-89A2-83BA9BA44A56}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>tut5</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<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|x64'">
<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)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</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>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\tut5.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,82 @@
// 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-element [path-element...]\n"
"Composes a path via operator/= from one or more path-element arguments\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;
for (; argc > 1; --argc, ++argv)
p /= argv[1]; // compose path p from the command line arguments
cout << "\ncomposed path:\n";
cout << " operator<<()---------: " << p << "\n";
cout << " make_preferred()-----: " << p.make_preferred() << "\n";
cout << "\nelements:\n";
for (auto element : p)
cout << " " << element << '\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;
}

View File

@@ -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;
}

View File

@@ -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();
}
}

View File

@@ -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;
}

View File

@@ -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>. ;

View File

@@ -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
echo Compiling example programs...
b2 %* >b2.log
find "error" <b2.log

View File

@@ -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
echo Compiling example programs...
b2 $* >b2.log
grep "error" <b2.log

View File

@@ -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
echo Copying example programs...
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

View File

@@ -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
echo Copying example programs...
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

View File

@@ -0,0 +1,23 @@
// 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;
}

View File

@@ -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;
}

View File

@@ -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]); // avoid repeated path construction below
if (exists(p)) // does path p actually exist?
{
if (is_regular_file(p)) // is path p a regular file?
cout << p << " size is " << file_size(p) << '\n';
else if (is_directory(p)) // is path p a directory?
cout << p << " is a directory\n";
else
cout << p << " exists, but is not a regular file or directory\n";
}
else
cout << p << " does not exist\n";
return 0;
}

View File

@@ -0,0 +1,52 @@
// 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 <boost/filesystem.hpp>
using std::cout;
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
cout << "Usage: tut3 path\n";
return 1;
}
path p (argv[1]);
try
{
if (exists(p))
{
if (is_regular_file(p))
cout << p << " size is " << file_size(p) << '\n';
else if (is_directory(p))
{
cout << p << " is a directory containing:\n";
for (directory_entry& x : directory_iterator(p))
cout << " " << x.path() << '\n';
}
else
cout << p << " exists, but is not a regular file or directory\n";
}
else
cout << p << " does not exist\n";
}
catch (const filesystem_error& ex)
{
cout << ex.what() << '\n';
}
return 0;
}

View File

@@ -0,0 +1,61 @@
// 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 <vector>
#include <algorithm>
#include <boost/filesystem.hpp>
using std::cout;
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
cout << "Usage: tut4 path\n";
return 1;
}
path p (argv[1]);
try
{
if (exists(p))
{
if (is_regular_file(p))
cout << p << " size is " << file_size(p) << '\n';
else if (is_directory(p))
{
cout << p << " is a directory containing:\n";
std::vector<std::string> v;
for (auto&& x : directory_iterator(p))
v.push_back(x.path().filename().string());
std::sort(v.begin(), v.end());
for (auto&& x : v)
cout << " " << x << '\n';
}
else
cout << p << " exists, but is not a regular file or directory\n";
}
else
cout << p << " does not exist\n";
}
catch (const filesystem_error& ex)
{
cout << ex.what() << '\n';
}
return 0;
}

View File

@@ -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;
}

View File

@@ -0,0 +1,48 @@
// filesystem tut6a.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 <iostream>
#include <exception>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut6a path\n";
return 1;
}
try
{
for (recursive_directory_iterator it (argv[1]);
it != recursive_directory_iterator();
++it)
{
if (it.level() > 1)
it.pop();
else
{
for (int i = 0; i <= it.level(); ++i)
std::cout << " ";
std::cout << it->path() << '\n';
}
}
}
catch (const std::exception& ex)
{
std::cout << "************* exception *****************\n";
std::cout << ex.what() << '\n';
}
return 0;
}

View File

@@ -0,0 +1,50 @@
// filesystem tut6b.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 <iostream>
#include <exception>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut6b path\n";
return 1;
}
try
{
for (recursive_directory_iterator it (argv[1]);
it != recursive_directory_iterator();
)
{
for (int i = 0; i <= it.level(); ++i)
std::cout << " ";
std::cout << it->path() << '\n';
try { ++it; }
catch (const filesystem_error& ex)
{
std::cout << "************* filesystem_error *****************\n";
std::cout << ex.what() << '\n';
}
}
}
catch (const std::exception& ex)
{
std::cout << "************* exception *****************\n";
std::cout << ex.what() << '\n';
}
return 0;
}

View File

@@ -0,0 +1,40 @@
// filesystem tut6c.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 <iostream>
#include <exception>
#include <boost/filesystem.hpp>
#include <boost/system/error_code.hpp>
using namespace boost::filesystem;
using namespace boost::system;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut6c path\n";
return 1;
}
error_code ec;
for (recursive_directory_iterator it (argv[1], ec);
it != recursive_directory_iterator();
)
{
for (int i = 0; i <= it.level(); ++i)
std::cout << " ";
std::cout << it->path() << '\n';
it.increment(ec);
}
return 0;
}

View File

@@ -0,0 +1,13 @@
<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>&copy; Copyright Beman Dawes, 2003</p>
<p> Distributed under the Boost Software License, Version 1.0.
See http://www.boost.org/LICENSE_1_0.txt</p>
</body>
</html>

View File

@@ -0,0 +1,14 @@
{
"key": "filesystem",
"name": "Filesystem",
"authors": [
"Beman Dawes"
],
"description": "The Boost Filesystem Library provides portable facilities to query and manipulate paths, files, and directories.",
"category": [
"System"
],
"maintainers": [
"Beman Dawes <bdawes -at- acm.org>"
]
}

View File

@@ -0,0 +1,84 @@
// 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/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/config.hpp>
#include <boost/filesystem/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 BOOST_SYSTEM_NOEXCEPT;
std::string message(int ev) const;
};
const char* codecvt_error_cat::name() const BOOST_SYSTEM_NOEXCEPT
{
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 filesystem
{
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 filesystem
} // namespace boost

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,917 @@
// 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
// Old standard library configurations, particularly MingGW, don't support wide strings.
// Report this with an explicit error message.
#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_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/config.hpp>
#include <boost/filesystem/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__) \
|| defined(__FreeBSD__) || defined(__OPEN_BSD__) || defined(__HAIKU__)
# include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
#endif
#ifdef BOOST_FILESYSTEM_DEBUG
# include <iostream>
# include <iomanip>
#endif
namespace fs = boost::filesystem;
using boost::filesystem::path;
using std::string;
using std::wstring;
using boost::system::error_code;
//--------------------------------------------------------------------------------------//
// //
// 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;
# ifdef BOOST_WINDOWS_API
const wchar_t 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'?';
inline bool is_letter(wchar_t c)
{
return (c >= L'a' && c <=L'z') || (c >= L'A' && c <=L'Z');
}
# else
const char separator = '/';
const char* const separators = "/";
const char* separator_string = "/";
const char* preferred_separator_string = "/";
const char dot = '.';
# endif
inline bool is_separator(fs::path::value_type c)
{
return c == separator
# ifdef BOOST_WINDOWS_API
|| c == path::preferred_separator
# endif
;
}
bool is_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 filesystem
{
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;
}
int path::compare(const path& p) const BOOST_NOEXCEPT
{
return detail::lex_compare(begin(), end(), p.begin(), p.end());
}
# ifdef BOOST_WINDOWS_API
const std::string path::generic_string() const
{
path tmp(*this);
std::replace(tmp.m_pathname.begin(), tmp.m_pathname.end(), L'\\', L'/');
return tmp.string();
}
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::remove_trailing_separator()
{
if (!m_pathname.empty() && is_separator(m_pathname[m_pathname.size() - 1]))
m_pathname.erase(m_pathname.size() - 1);
return *this;
}
path& path::replace_extension(const path& new_extension)
{
// erase existing extension, including the dot, if any
m_pathname.erase(m_pathname.size()-extension().m_pathname.size());
if (!new_extension.empty())
{
// append new_extension, adding the dot if necessary
if (new_extension.m_pathname[0] != dot)
m_pathname.push_back(dot);
m_pathname.append(new_extension.m_pathname);
}
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_root_separator(m_pathname, pos))
? detail::dot_path()
: path(m_pathname.c_str() + pos);
}
path path::stem() const
{
path name(filename());
if (name == detail::dot_path() || name == detail::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 == detail::dot_path() || name == detail::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 == detail::dot_path()) temp /= detail::dot_path();
continue;
}
}
temp /= *itr;
};
if (temp.empty()) temp /= detail::dot_path();
m_pathname = temp.m_pathname;
return *this;
}
} // namespace filesystem
} // namespace boost
//--------------------------------------------------------------------------------------//
// //
// class path helpers implementation //
// //
//--------------------------------------------------------------------------------------//
namespace
{
// is_root_separator ---------------------------------------------------------------//
bool is_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;
// "/" [...]
if (pos == 0)
return true;
# ifdef BOOST_WINDOWS_API
// "c:/" [...]
if (pos == 2 && is_letter(str[0]) && str[1] == colon)
return true;
# endif
// "//" name "/"
if (pos < 3 || !is_separator(str[0]) || !is_separator(str[1]))
return false;
return str.find_first_of(separators, 2) == pos;
}
// 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 && end_pos > 1)
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;
}
} // unnamed namespace
namespace boost
{
namespace filesystem
{
namespace detail
{
BOOST_FILESYSTEM_DECL
int lex_compare(path::iterator first1, path::iterator last1,
path::iterator first2, path::iterator last2)
{
for (; first1 != last1 && first2 != last2;)
{
if (first1->native() < first2->native()) return -1;
if (first2->native() < first1->native()) return 1;
BOOST_ASSERT(first2->native() == first1->native());
++first1;
++first2;
}
if (first1 == last1 && first2 == last2)
return 0;
return first1 == last1 ? -1 : 1;
}
BOOST_FILESYSTEM_DECL
const path& dot_path()
{
# ifdef BOOST_WINDOWS_API
static const fs::path dot_pth(L".");
# else
static const fs::path dot_pth(".");
# endif
return dot_pth;
}
BOOST_FILESYSTEM_DECL
const path& dot_dot_path()
{
# ifdef BOOST_WINDOWS_API
static const fs::path dot_dot(L"..");
# else
static const fs::path dot_dot("..");
# endif
return dot_dot;
}
}
//--------------------------------------------------------------------------------------//
// //
// class path::iterator implementation //
// //
//--------------------------------------------------------------------------------------//
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; if current element is implicit dot,
// this will cause it.m_pos to represent the end iterator
it.m_pos += it.m_element.m_pathname.size();
// if the end is reached, we are done
if (it.m_pos == it.m_path_ptr->m_pathname.size())
{
it.m_element.clear(); // aids debugging, may release unneeded memory
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; // generic format; see docs
return;
}
// skip separators until it.m_pos points to the start of the next element
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_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1))
{
--it.m_pos;
it.m_element = detail::dot_path();
return;
}
}
// get m_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_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1)
)
{
--it.m_pos;
it.m_element = detail::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) // needed for Windows, harmless on POSIX
it.m_element.m_pathname = separator_string; // generic format; see docs
}
} // namespace filesystem
} // namespace boost
namespace
{
//------------------------------------------------------------------------------------//
// locale helpers //
//------------------------------------------------------------------------------------//
// Prior versions of these locale and codecvt implementations tried to take advantage
// of static initialization where possible, kept a local copy of the current codecvt
// facet (to avoid codecvt() having to call use_facet()), and was not multi-threading
// safe (again for efficiency).
//
// This was error prone, and required different implementation techniques depending
// on the compiler and also whether static or dynamic linking was used. Furthermore,
// users could not easily provide their multi-threading safe wrappers because the
// path interface requires the implementation itself to call codecvt() to obtain the
// default facet, and the initialization of the static within path_locale() could race.
//
// The code below is portable to all platforms, is much simpler, and hopefully will be
// much more robust. Timing tests (on Windows, using a Visual C++ release build)
// indicated the current code is roughly 9% slower than the previous code, and that
// seems a small price to pay for better code that is easier to use.
inline std::locale default_locale()
{
# if defined(BOOST_WINDOWS_API)
std::locale global_loc = std::locale();
return std::locale(global_loc, new windows_file_codecvt);
# elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) \
|| defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__)
// "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 global_loc = std::locale();
return std::locale(global_loc, new boost::filesystem::detail::utf8_codecvt_facet);
# 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.
return std::locale("");
# endif
}
inline std::locale& path_locale()
// std::locale("") construction, needed on non-Apple POSIX systems, can throw
// (if environmental variables LC_MESSAGES or LANG are wrong, for example), so
// path_locale() provides lazy initialization via a local static to ensure that any
// exceptions occur after main() starts and so can be caught. Furthermore,
// path_locale() is only called if path::codecvt() or path::imbue() are themselves
// actually called, ensuring that an exception will only be thrown if std::locale("")
// is really needed.
{
static std::locale loc(default_locale());
#ifdef BOOST_FILESYSTEM_DEBUG
std::cout << "***** path_locale() called" << std::endl;
#endif
return loc;
}
} // unnamed namespace
//--------------------------------------------------------------------------------------//
// path::codecvt() and path::imbue() implementation //
//--------------------------------------------------------------------------------------//
namespace boost
{
namespace filesystem
{
// See comments above
const path::codecvt_type& path::codecvt()
{
#ifdef BOOST_FILESYSTEM_DEBUG
std::cout << "***** path::codecvt() called" << std::endl;
#endif
BOOST_ASSERT_MSG(&path_locale(), "boost::filesystem::path locale initialization error");
return std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale());
}
std::locale path::imbue(const std::locale& loc)
{
#ifdef BOOST_FILESYSTEM_DEBUG
std::cout << "***** path::imbue() called" << std::endl;
#endif
std::locale temp(path_locale());
path_locale() = loc;
return temp;
}
} // namespace filesystem
} // namespace boost

View File

@@ -0,0 +1,200 @@
// 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
//--------------------------------------------------------------------------------------//
// 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/config.hpp>
#include <boost/filesystem/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::filesystem::path_traits;
namespace fs = boost::filesystem;
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 filesystem { 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::filesystem::path_traits

View File

@@ -0,0 +1,119 @@
// 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
//--------------------------------------------------------------------------------------//
// 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/config.hpp>
#include <boost/filesystem/path.hpp>
namespace fs = boost::filesystem;
#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 filesystem
{
// 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 filesystem
} // namespace boost

View File

@@ -0,0 +1,144 @@
// filesystem unique_path.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
//--------------------------------------------------------------------------------------//
// 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/operations.hpp>
#include <cassert>
# 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 filesystem { 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";
char ran[] = "123456789abcdef"; // init to avoid clang static analyzer message
// see ticket #8954
assert(sizeof(ran) == 16);
const int max_nibbles = 2 * sizeof(ran); // 4-bits per nibble
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;
}
}}}

View File

@@ -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 <boost/detail/utf8_codecvt_facet.ipp>
#undef BOOST_UTF8_BEGIN_NAMESPACE
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL

View File

@@ -0,0 +1,75 @@
// 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
//--------------------------------------------------------------------------------------//
// 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/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

View File

@@ -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/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

View File

@@ -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 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 Filesystem
# has a history of bugs that appear only in one type of build or the other.
test-suite "filesystem" :
[ run convenience_test.cpp ]
[ compile macro_default_test.cpp ]
[ run odr1_test.cpp odr2_test.cpp ]
[ run deprecated_test.cpp ]
[ run fstream_test.cpp ]
[ run large_file_support_test.cpp ]
[ run locale_info.cpp : : : <test-info>always_show_run_output ]
[ run operations_test.cpp : : : <link>shared <test-info>always_show_run_output ]
[ run operations_test.cpp : : : <link>static : operations_test_static ]
[ run operations_unit_test.cpp : : : <link>shared <test-info>always_show_run_output ]
[ run path_test.cpp : : : <link>shared ]
[ run path_test.cpp : : : <link>static : path_test_static ]
[ run path_unit_test.cpp : : : <link>shared ]
[ run path_unit_test.cpp : : : <link>static : path_unit_test_static ]
[ run ../example/simple_ls.cpp ]
[ run ../example/file_status.cpp ]
;

View File

@@ -0,0 +1,177 @@
// 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
#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>
#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/detail/lightweight_test.hpp>
#include <boost/detail/lightweight_main.hpp>
#include <boost/bind.hpp>
#include <fstream>
#include <iostream>
namespace fs = boost::filesystem;
using fs::path;
namespace sys = boost::system;
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
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();
}

View File

@@ -0,0 +1,249 @@
// 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_DEPRECATED
#include <boost/filesystem.hpp>
#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/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();
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -0,0 +1,169 @@
// 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
#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/config.hpp>
# if defined( BOOST_NO_STD_WSTRING )
# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
# endif
#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>
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("narrow_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";
std::wstring ws(L"wide_fstream_test_");
ws += 0x2780;
ws += 0x263A;
test(ws);
return ::boost::report_errors();
}

View File

@@ -0,0 +1,8 @@
#include <boost/filesystem.hpp>
int main(void)
{
boost::filesystem::copy_file("a", "b");
return 0;
}

View File

@@ -0,0 +1,17 @@
// Linux test; before running: export LANG=foo
#include <locale>
#include <iostream>
#include <string>
#include <boost/filesystem/path.hpp>
int main()
{
std::string pathname = "/some/filesystem/path/%%%%";
boost::filesystem::path path(pathname);
std::wcout << path.wstring() << std::endl;
return 0;
}

View File

@@ -0,0 +1,14 @@
// Copyright iamvfx@gmail.com 2014
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#include <stdio.h>
#include <boost/filesystem.hpp>
int main()
{
boost::filesystem::path dir("/");
for (char c : dir.filename().string())
printf("%c\n", c);
}

View File

@@ -0,0 +1,20 @@
#include <iostream>
#include <boost/filesystem/path.hpp>
using namespace std;
namespace fs = boost::filesystem;
int main(int argc, char** argv)
{
try
{
fs::path my_path("test/test.txt");
cout << "current path is " << my_path << endl;
cout << "parent path is " << my_path.parent_path() << endl;
}
catch(std::exception& e) {
cerr << endl << "Error during execution: " << e.what() << endl << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,37 @@
#include <boost/filesystem.hpp>
#include <cvt/cp950>
#include <iostream>
#include <string>
#include <locale>
namespace fs = boost::filesystem;
int main(void) {
std::locale global_loc = std::locale();
std::locale loc(global_loc, new stdext::cvt::codecvt_cp950<wchar_t>);
fs::path::imbue(loc);
std::cout <<
"HEADS UP! PIPE OUTPUT TO FILE AND INSPECT WITH HEX OR CP950 EDITOR.\n"
"WINDOWS COMMAND PROMPT FONTS DON'T SUPPORT CHINESE,\n"
"EVEN WITH CODEPAGE SET AND EVEN AS OF WIN 10 TECH PREVIEW." << std::endl;
fs::recursive_directory_iterator end;
fs::recursive_directory_iterator iter
("C:/boost/test-files/utf-8");
while (iter != end)
{
if (fs::is_directory(*iter))
{
std::cout << "[directory] " << iter->path().generic_string() << std::endl;
}
else if (fs::is_regular(*iter))
{
std::cout << " [file] " << iter->path().generic_string() << std::endl;
}
++iter;
}
return 0;
}

View File

@@ -0,0 +1,20 @@
#include <iostream>
#include <boost/filesystem.hpp>
using boost::filesystem::path;
int main()
{
std::cout << path("a").stem() << std::endl;
std::cout << path("a/").stem() << std::endl;
std::cout << path("a/b").stem() << std::endl;
std::cout << path("a/b/").stem() << std::endl;
std::cout << path("a/b/c").stem() << std::endl;
std::cout << path("a/b/c/").stem() << std::endl;
std::cout << path("a/b/c/d").stem() << std::endl;
std::cout << path("a/b/c/d/").stem() << std::endl;
std::cout << path("a/b/c/d/e").stem() << std::endl;
std::cout << path("a/b/c/d/e/").stem() << std::endl;
return 0;
}

View File

@@ -0,0 +1,7 @@
// Before running this test: export LANG=foo
#include <boost/filesystem.hpp>
int main() {
boost::filesystem::path("/abc").root_directory();
}

View File

@@ -0,0 +1,10 @@
#include "boost/filesystem.hpp"
static const boost::filesystem::path::codecvt_type &dummy =
boost::filesystem::path::codecvt();
int main()
{
return 0;
}

View File

@@ -0,0 +1,40 @@
// Boost 9219.cpp --------------------------------------------------------------------//
// Copyright Beman Dawes 2014
// 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
//--------------------------------------------------------------------------------------//
// //
// In researching filesystem issues it is convenient to have a program that can be //
// quickly modified to test reported problems. That's the purpose of this file and //
// its associated Visual Studio and Boost.Build infrastructure. //
// //
//--------------------------------------------------------------------------------------//
#include <boost/config/warning_disable.hpp>
#include <boost/filesystem.hpp>
#include <iostream>
#include <boost/detail/lightweight_test.hpp>
#include <boost/detail/lightweight_main.hpp>
using std::cout;
using std::endl;
namespace fs = boost::filesystem;
//------------------------------------ cpp_main --------------------------------------//
int cpp_main(int argc, char* argv[])
{
cout << "Hello, 9219" << endl;
cout << "This is a test for non-Windows systems" << endl;
BOOST_TEST(fs::exists(const_cast<char*>(".")));
return ::boost::report_errors();
} // cpp_main

View File

@@ -0,0 +1,35 @@
# Boost Filesystem test/issues Jamfile
# Copyright Beman Dawes 2014
# 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
;
test-suite "filesystem-issues" :
# [ run 9054_static_const_codecvt_segfault_pre_main.cpp
# : : : <link>shared : 9054_shared ]
# [ run 9054_static_const_codecvt_segfault_pre_main.cpp
# : : : <link>static : 9054_static ]
# [ run hello_filesystem.cpp
# : : : <link>shared : hello_shared ]
# [ run hello_filesystem.cpp
# : : : <link>static : hello_static ]
# [ run 9219.cpp
# : : : <link>shared : 9219_shared ]
# [ run 9219.cpp
# : : : <link>static : 9219_static ]
# [ run 10485.cpp
# : : : <link>shared <test-info>always_show_run_output ]
[ run copy_file-compilation-error-2015-05-04.cpp ]
;

View File

@@ -0,0 +1,14 @@
// Rob Conde <rob.conde@ai-solutions.com> reports this fails
// to compile for Boost 1.58 with g++ 4.4.7 but is OK with FC++ 2013
#include "boost/filesystem/operations.hpp"
void myFunc()
{
using namespace boost::filesystem;
copy_option opt(copy_option::overwrite_if_exists);
copy_file(path("p1"),path("p2"),copy_option::overwrite_if_exists);
// copy_file(path("p1"),path("p2"),opt);
}

View File

@@ -0,0 +1,38 @@
// Test program to demonstrate that Linux does not support AT_SYMLINK_NOFOLLOW
// Copyright Duncan Exon Smith 2012
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Test this by running:
//
// rm -rf data && mkdir data && g++ -otest-fchmodat fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp && (cd data && ../test-fchmodat)
//
// If no assertions go off, then it looks like fchmodat is supported,
// but AT_SYMLINK_NOFOLLOW is not supported.
#include <fstream>
#include <cassert>
#include <fcntl.h>
#include <sys/stat.h>
#include <cerrno>
#ifdef NDEBUG
# error This program depends on assert() so makes no sense if NDEBUG is defined
#endif
int main(int argc, char *argv[])
{
{ std::ofstream file("out"); file << "contents"; }
assert(!::symlink("out", "sym"));
assert(!::fchmodat(AT_FDCWD, "out", S_IRUSR | S_IWUSR | S_IXUSR, 0));
assert(!::fchmodat(AT_FDCWD, "sym", S_IRUSR | S_IWUSR | S_IXUSR, 0));
assert(::fchmodat(AT_FDCWD, "sym", S_IRUSR | S_IWUSR | S_IXUSR, AT_SYMLINK_NOFOLLOW) == -1);
assert(errno == ENOTSUP);
return 0;
}

View File

@@ -0,0 +1,39 @@
// Boost hello_filesystem.cpp --------------------------------------------------------//
// Copyright Beman Dawes 2014
// 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
//--------------------------------------------------------------------------------------//
// //
// In researching filesystem issues it is convenient to have a program that can be //
// quickly modified to test reported problems. That's the purpose of this file and //
// its associated Visual Studio and Boost.Build infrastructure. //
// //
//--------------------------------------------------------------------------------------//
#include <boost/config/warning_disable.hpp>
#include <boost/filesystem.hpp>
#include <iostream>
#include <boost/detail/lightweight_test.hpp>
#include <boost/detail/lightweight_main.hpp>
using std::cout;
using std::endl;
namespace fs = boost::filesystem;
//------------------------------------ cpp_main --------------------------------------//
int cpp_main(int argc, char* argv[])
{
cout << "Hello, filesystem world" << endl;
BOOST_TEST(fs::exists("."));
return ::boost::report_errors();
} // cpp_main

View File

@@ -0,0 +1,9 @@
This directory contains tests related to specific issues.
The names are intended to indicate both the function or condition being tested
and the issue number.
-----
Copyright Beman Dawes 2012
Distributed under the Boost Software License, Version 1.0.
See http://www.boost.org/LICENSE_1_0.txt

View File

@@ -0,0 +1,132 @@
// Boost Filesystem recurse_dir_iter_test.cpp ----------------------------------------//
// Copyright Beman Dawes 2014.
// 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/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/config.hpp>
# if defined( BOOST_NO_STD_WSTRING )
# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
# endif
#include <boost/cerrno.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/detail/lightweight_main.hpp>
namespace fs = boost::filesystem;
using boost::system::error_code;
using boost::system::system_category;
using boost::system::system_error;
#include <iostream>
using std::cout;
using std::endl;
#ifdef BOOST_WINDOWS_API
# include <windows.h>
#endif
namespace
{
typedef int errno_t;
std::string platform(BOOST_PLATFORM);
bool report_throws = false;
bool cleanup = true;
bool skip_long_windows_tests = false;
unsigned short language_id; // 0 except for Windows
} // 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 made 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;
cout << "initial_path() is " << fs::initial_path() << endl;
fs::path ip = fs::initial_path();
for (fs::path::const_iterator it = ip.begin(); it != ip.end(); ++it)
{
if (it != ip.begin())
cout << ", ";
cout << *it;
}
cout << endl;
// From the root, walk the directory tree looking for a permissions error
fs::recursive_directory_iterator it("/");
fs::recursive_directory_iterator end_it;
// The increment function has an invarient that it always makes progress,
// so even if an error occurs this loop will eventually terminate.
while (it != end_it)
{
error_code ec;
fs::path init_path = it->path();
it.increment(ec);
if (ec)
{
cout << "initial path: " << init_path << endl;
cout << "error_code: " << ec.value() << " with msg: " << ec.message() << endl;
if (it != end_it)
cout << "post-increment path: " << it->path() << endl;
}
}
cout << "returning from main()" << endl;
return ::boost::report_errors();
} // main

View File

@@ -0,0 +1,42 @@
// 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
// See deprecated_test for tests of deprecated features
#define BOOST_FILESYSTEM_NO_DEPRECATED
#define BOOST_SYSTEM_NO_DEPRECATED
#include <boost/filesystem/operations.hpp>
#include <boost/config.hpp>
# if defined( BOOST_NO_STD_WSTRING )
# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
# endif
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;
}

View File

@@ -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

View File

@@ -0,0 +1,59 @@
// 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
#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();
}

View File

@@ -0,0 +1,36 @@
// macro_default_test program --------------------------------------------------------//
// Copyright Beman Dawes 2012
// 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
#undef BOOST_ALL_DYN_LINK
#undef BOOST_ALL_STATIC_LINK
#undef BOOST_FILESYSTEM_DYN_LINK
#undef BOOST_FILESYSTEM_STATIC_LINK
#undef BOOST_SYSTEM_DYN_LINK
#undef BOOST_SYSTEM_STATIC_LINK
#ifndef BOOST_ALL_NO_LIB
# define BOOST_ALL_NO_LIB
#endif
#include <boost/filesystem/config.hpp>
#include <boost/system/config.hpp>
#ifndef BOOST_FILESYSTEM_STATIC_LINK
# error BOOST_FILESYSTEM_STATIC_LINK not set by default
#endif
#ifndef BOOST_SYSTEM_STATIC_LINK
# error BOOST_SYSTEM_STATIC_LINK not set by default
#endif
int main()
{
return 0;
}

View File

@@ -0,0 +1,18 @@
<?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>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>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>

View File

@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</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>
</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>

View File

@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</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>
</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>

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.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>{0EA788CA-FA52-4290-A4D0-F616390B203B}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>exec_monitor_dll</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</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;_WINDOWS;_USRDLL;EXEC_MONITOR_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</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;_WINDOWS;_USRDLL;EXEC_MONITOR_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\test\src\cpp_main.cpp" />
<ClCompile Include="..\..\..\..\test\src\debug.cpp" />
<ClCompile Include="..\..\..\..\test\src\execution_monitor.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.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>
<ItemGroup>
<ClCompile Include="..\..\..\..\test\src\cpp_main.cpp" />
<ClCompile Include="..\..\..\..\test\src\debug.cpp" />
<ClCompile Include="..\..\..\..\test\src\execution_monitor.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{272DFC15-6292-49DF-B457-6784A183EAC3}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>exec_monitor_lib</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</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" />
</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" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Some files were not shown because too many files have changed in this diff Show More