|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59849 - in sandbox/filesystem-v3: boost/filesystem libs/filesystem/doc libs/filesystem/example libs/filesystem/src libs/filesystem/test
From: bdawes_at_[hidden]
Date: 2010-02-22 19:31:03
Author: bemandawes
Date: 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
New Revision: 59849
URL: http://svn.boost.org/trac/boost/changeset/59849
Log:
beta 1 fixes, including rename path::absolute to make_absolute and preferred -> make_preferred
Text files modified:
sandbox/filesystem-v3/boost/filesystem/operations.hpp | 4 +-
sandbox/filesystem-v3/boost/filesystem/path.hpp | 4 +-
sandbox/filesystem-v3/libs/filesystem/doc/do_list.html | 46 +++++++++++++++++++++++--
sandbox/filesystem-v3/libs/filesystem/doc/reference.html | 35 ++++++++++---------
sandbox/filesystem-v3/libs/filesystem/doc/tutorial.html | 71 ++++++++++++++++++++-------------------
sandbox/filesystem-v3/libs/filesystem/doc/v3.html | 13 +++---
sandbox/filesystem-v3/libs/filesystem/example/path_info.cpp | 4 +-
sandbox/filesystem-v3/libs/filesystem/example/tut4.cpp | 6 --
sandbox/filesystem-v3/libs/filesystem/src/path.cpp | 4 +-
sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp | 4 +-
sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp | 64 ++++++++++++++++++------------------
sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp | 34 +++++++++---------
12 files changed, 162 insertions(+), 127 deletions(-)
Modified: sandbox/filesystem-v3/boost/filesystem/operations.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/operations.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/operations.hpp 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -250,13 +250,13 @@
inline
path complete(const path& p)
{
- return path(p).absolute(detail::initial_path(0));
+ return path(p).make_absolute(detail::initial_path(0));
}
inline
path complete(const path& p, const path& base)
{
- return path(p).absolute(base);
+ return path(p).make_absolute(base);
}
# endif
Modified: sandbox/filesystem-v3/boost/filesystem/path.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path.hpp 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -206,9 +206,9 @@
// ----- modifiers -----
- path& absolute(const path& base);
void clear() { m_pathname.clear(); }
- path& preferred()
+ path& make_absolute(const path& base);
+ path& make_preferred()
# ifdef BOOST_POSIX_PATH
{ return *this; } // POSIX no effect
# else // BOOST_WINDOWS_PATH
Modified: sandbox/filesystem-v3/libs/filesystem/doc/do_list.html
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/do_list.html (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/do_list.html 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -16,14 +16,12 @@
<body>
<h1>Boost Filesystem Do List<br>
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->20 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40539" --></h1>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->22 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40543" --></h1>
<h2>Beta 1 comments</h2>
<ul>
- <li>Add ack for commenters.</li>
- <li>Rename absolute. make_absolute?</li>
- <li>Rename unique_path -> generate_unique_path.</li>
- <li>Should "change_extension" be "replace_extensioin"? What did V2 call it?</li>
+ <li>Add ack for commenters.<br>
+ </li>
<li dir="ltr">
<p dir="ltr">Zach Laine:</li>
@@ -57,6 +55,44 @@
can just cut-and-paste to get the basic code needed to use the
library.</pre>
</blockquote>
+<ul>
+ <li dir="ltr">
+<p dir="ltr">Scott McMurray - treat as Wish List:</li>
+</ul>
+<blockquote>
+ <pre dir="ltr">- uncomplete(p, base)
+
+My pet request. It may be useful to simplify other functions as well,
+since there's no current way to go from an absolute path to a relative
+one, meaning that most functions need to handle relative ones even
+when that might not be natural. With this functionality,
+preconditions requiring absolute paths would be less onerous.
+
+ Precondition: p.is_absolute() && base.is_absolute()
+
+ Effects: Extracts a path, rp, from p relative to base such that
+canonical(p) == complete(rp, base). Any ".." path elements in rp form
+a prefix.
+
+ Returns: The extracted path.
+
+ Postconditions: For the returned path, rp, rp.is_relative() ==
+(p.root_name() == b.root_name()).
+
+[Notes: This function simplifies paths by omitting context. It is
+particularly useful for serializing paths such that it can be usefully
+moved between hosts where the context may be different, such as inside
+source control trees. It can also be helpful for display to users,
+such as in shells where paths are often shown relative to $HOME.
+
+In the presence of symlinks, the result of this function may differ
+between implementations, as some may expand symlinks that others may
+not. The simplest implementation uses canonical to expand both p and
+base, then removes the common prefix and prepends the requisite ".."
+elements. Smarter implementations will avoid expanding symlinks
+unnecessarily. No implementation is expected to discover new symlinks
+to return paths with fewer elements.]</pre>
+</blockquote>
<h2 dir="ltr">Docs</h2>
<ul>
<li>Reorganize files</li>
Modified: sandbox/filesystem-v3/libs/filesystem/doc/reference.html
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/reference.html (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/reference.html 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -113,7 +113,8 @@
  status<br>
  status_known<br>
  symlink_status<br>
-   system_complete</td>
+   system_complete<br>
+ unique_path</td>
<td width="34%" valign="top">
<a href="#File-streams">File streams</a><br>
<a href="#Path-decomposition-table">Path decomposition table</a><br>
@@ -520,12 +521,12 @@
path& operator/=(Source const& source);
// modifiers
- path& absolute(const path& base);
- void clear();
- path& preferred(); // POSIX: no effect. Windows: convert slashes to backslashes
- path& remove_filename();
- path& replace_extension(const path& new_extension = path());
- void swap(path& rhs);
+ void clear();
+ path& make_absolute(const path& base);
+ path& make_preferred(); // POSIX: no effect. Windows: convert slashes to backslashes
+ path& remove_filename();
+ path& replace_extension(const path& new_extension = path());
+ void swap(path& rhs);
// native format observers
const string_type& native() const; // native format, encoding
@@ -768,12 +769,16 @@
<h3> <a name="path-modifiers"> <code>
<font size="4">path</font></code> modifiers</a></h3>
-<pre>path& <a name="absolute">absolute</a>(const path& base);</pre>
+<pre>void <a name="path-clear">clear</a>();</pre>
+<blockquote>
+<p><i>Postcondition:</i> <code>this->empty()</code> is true.</p>
+</blockquote>
+<pre>path& <a name="path-make_absolute">make_absolute</a>(const path& base);</pre>
<blockquote>
<p><i>Preconditions:</i> <code>
(has_root_name() || base.has_root_name() || path("/").is_absolute()) && (has_root_directory()
|| base.has_root_directory())</code> is true.</p>
- <p><i>Effects:</i> Makes <code>pathname</code> absolute by applying the following rules:</p>
+ <p><i>Effects:</i> Makes <code>m_pathname</code> absolute by applying the following rules:</p>
<table border="1" cellpadding="5" cellspacing="0" bordercolor="#111111" style="border-collapse: collapse">
<tr>
<td align="center"> </td>
@@ -807,11 +812,7 @@
is expected by program users. <i>--
end note</i>]</p>
</blockquote>
-<pre>void clear();</pre>
-<blockquote>
-<p><i>Postcondition:</i> <code>this->empty()</code> is true.</p>
-</blockquote>
-<pre>path& preferred();</pre>
+<pre>path& <a name="path-make_preferred">make_preferred</a>();</pre>
<blockquote>
<p><i>Effects:</i> The contained pathname is converted to the preferred native
format. [<i>Note:</i> On Windows, the effect is to replace slashes with
@@ -819,7 +820,7 @@
<p><i>Returns:</i> <code>*this</code></p>
</blockquote>
-<pre>path& remove_filename();</pre>
+<pre>path& <a name="path-remove_filename">remove_filename</a>();</pre>
<blockquote>
<p><i>Returns: </i>As if, <code>*this = parent_path();</code></p>
<p>[<i>Note:</i> This function is needed to efficiently implement <code>
@@ -827,7 +828,7 @@
implementation may be much more efficient than <code>*this = parent_path()</code> <i>-- end
note</i>]</p>
</blockquote>
-<pre>path& replace_extension(const path& new_extension = path());</pre>
+<pre>path& <a name="path-replace_extension">replace_extension</a>(const path& new_extension = path());</pre>
<blockquote>
<p><i>Postcondition: </i> <code>extension() == <i>replacement</i></code>,
where <code><i>replacement</i></code> is <code>new_extension</code> if <code>
@@ -836,7 +837,7 @@
<code>new_extension</code>.</p>
<p><i>Returns:</i> <code>*this</code></p>
</blockquote>
-<pre><code><span style="background-color: #FFFFFF">void swap(path& rhs);</span></code></pre>
+<pre><code><span style="background-color: #FFFFFF">void <a name="path-swap">swap</a>(path& rhs);</span></code></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF">
Swaps the contents of the two paths.</span></p>
Modified: sandbox/filesystem-v3/libs/filesystem/doc/tutorial.html
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/tutorial.html (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/tutorial.html 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -483,13 +483,7 @@
typedef vector<path> vec; // store paths,
vec v; // so we can sort them later
- for (directory_iterator it (p); // initialize it to the first element
- it != directory_iterator(); // test for the past-the-end element
- ++it) // increment
- {
- path fn = it->path().filename(); // extract the filename from the path
- v.push_back(fn); // push into vector for later sorting
- }
+ copy(directory_iterator(p), directory_iterator(), back_inserter(v));
sort(v.begin(), v.end()); // sort, since directory iteration
// is not ordered on some file systems
@@ -873,7 +867,7 @@
<p><code>path::iterator::value_type</code> is <code>path::string_type</code>,
and iteration treats <code>path</code> as a container of filenames.</p>
-<p dir="ltr">Let's look at some at the output from the a slightly different
+<p dir="ltr">Let's look at some of the output from a slightly different
example:</p>
<table align="center" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%">
@@ -1036,7 +1030,7 @@
</tr>
<tr>
<td width="50%" style="font-size: 10pt">
- <pre>$ ./path_info / foo/bar baz.txt
+ <pre>$ ./path_info / foo/bar baa.txt
composed path:
cout << -------------: /foo/bar/baa.txt
@@ -1058,38 +1052,47 @@
<h2><a name="Error-reporting">Error reporting</a></h2>
- <p>Legacy C interfaces like the original <code>rename</code> function report
- errors via an error code, typically obtained via <code>errno</code>. The
- preferred C++ practice is to throw an exception to report an error, and that's
- how the first of the two Boost.Filesystem <code>rename</code> functions
- reports errors. A <code>filesystem_error</code> exception will be thrown on an
- operational error. It's derived from <code>std::runtime_error</code> and has a
- member function to obtain the <code>error_code</code> reported by the source
- of the error. It also has member functions to obtain the path[s] that caused
+ <p>The Boost.Filesystem <code>file_size</code> function has two overloads:</p>
+
+ <blockquote>
+ <pre><span style="background-color: #FFFFFF; ">uintmax_t</span> <a name="file_size">file_size</a>(const path& p);
+<span style="background-color: #FFFFFF; ">uintmax_t</span> <a name="file_size2">file_size</a>(const path& p, system::error_code& ec);</pre>
+</blockquote>
+<p>The only significant difference between the two is how they report errors.</p>
+<p>The
+ first signature will throw exceptions to report errors. A <code>
+filesystem_error</code> exception will be thrown
+on an
+ operational error. <code>filesystem_error</code> is derived from <code>std::runtime_error</code>.
+It has a
+ member function to obtain the <code>
+error_code</code> reported by the source
+ of the error. It also has member functions to obtain the path or paths that caused
the error.</p>
- <p>That was the entire error reporting story for the earliest versions of
- Boost.Filesystem, and indeed throwing exceptions on errors worked very well in
- many applications. But some user reports trickled in of code that became so
- littered by try and catch blocks as to be unreadable and unmaintainable. In
- some applications I/O errors aren't exceptional, and that's why most
- Boost.Filesystem operational functions come in two flavors.</p>
-
- <p>Functions without a <code>system::error_code&</code>
-argument throw exceptions to report operational errors. These functions should
- be your default choice, unless you really do need to deal with errors via hand
- coded error tests.</p>
-
- <p>Functions with a <code>system::error_code&</code>
-argument report operational error status by setting the <code>ec</code> argument, and
-do not throw exceptions when I/O errors occur.</p>
+ <blockquote>
+
+ <p><b>Motivation for the second signature:</b> Throwing exceptions on errors was the entire error reporting story for the earliest versions of
+ Boost.Filesystem, and indeed throwing exceptions on errors works very well for
+ many applications. But user reports trickled in that some code became so
+ littered with try and catch blocks as to be unreadable and unmaintainable. In
+ some applications I/O errors aren't exceptional, and that's the use case for
+ the second signature.</p>
+
+ </blockquote>
+
+ <p>Functions with a <code>system::error_code&</code> argument set that
+ argument to report operational error status, and so do not throw exceptions when I/O
+ related errors occur. For a full explanation, see
+ Error reporting in the reference
+ documentation. </p>
<hr>
-<p>© Copyright Beman Dawes 2010</p>
+<p>© Copyright Beman Dawes 2010</p>
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
<p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->21 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40541" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->22 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40543" --></p>
</body>
Modified: sandbox/filesystem-v3/libs/filesystem/doc/v3.html
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/v3.html (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/v3.html 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -49,16 +49,16 @@
supported. This is a major simplification of the path abstraction,
particularly for functions that take path arguments.<br>
</li>
- <li>New class path members include:<br>
+ <li>New <code>class path</code> members include:<br>
<ul>
<li><code>has_stem()</code></li>
<li><code>has_extension()</code></li>
<li><code>is_absolute()</code>. This renames <code>is_complete()</code>, which
is now deprecated.</li>
<li><code>is_relative()</code></li>
- <li><code>absolute()</code>. This replaces the operations function <code>
+ <li><code>make_absolute()</code>. This replaces the operations function <code>
complete()</code>, which is now deprecated.</li>
- <li><code>preferred()<br>
+ <li><code>make_preferred()<br>
</code></li>
</ul>
@@ -70,7 +70,7 @@
Windows. Used to read the contents of a symlink itself.</li>
<li><code>resize_file()</code> function added. Supported on both POSIX and
Windows. Used to shrink or grow a regular file.</li>
- <li><code>unique_path()</code> function added. Supported on both POSIX and
+ <li><code>unique_path()</code> function added. Supported on both POSIX and
Windows. Used to generate a secure temporary pathname.<br>
</li>
</ul>
@@ -93,8 +93,7 @@
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 gone.
- <span style="background-color: #FFFF00">...</span></li>
+ <li>Class template <code>basic_path</code> and its specializations are gone.</li>
<li>Certain functions now return <code>path</code> objects rather than <code>
basic_string</code> objects:<ul>
<li><code>root_name()</code></li>
@@ -123,7 +122,7 @@
<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 -->18 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40554" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->22 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40543" --></p>
</body>
Modified: sandbox/filesystem-v3/libs/filesystem/example/path_info.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/example/path_info.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/example/path_info.cpp 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -35,11 +35,11 @@
cout << "\ncomposed path:\n";
cout << " cout << -------------: " << p << "\n";
- cout << " preferred()----------: " << path(p).preferred() << "\n";
+ cout << " make_preferred()----------: " << path(p).make_preferred() << "\n";
cout << "\nelements:\n";
- for (path::iterator it = p.begin(); it != p.end(); ++it)
+ for (path::iterator it(p.begin()), it_end(p.end()); it != it_end; ++it)
cout << " " << *it << '\n';
cout << "\nobservers, native format:" << endl;
Modified: sandbox/filesystem-v3/libs/filesystem/example/tut4.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/example/tut4.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/example/tut4.cpp 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -39,11 +39,7 @@
typedef vector<path> vec; // store paths,
vec v; // so we can sort them later
- for (directory_iterator it(p), it_end; it != it_end; ++it) // iterate over directory
- {
- path fn = it->path().filename(); // extract the filename from the path
- v.push_back(fn); // push into vector for later sorting
- }
+ copy(directory_iterator(p), directory_iterator(), back_inserter(v));
sort(v.begin(), v.end()); // sort, since directory iteration
// is not ordered on some file systems
Modified: sandbox/filesystem-v3/libs/filesystem/src/path.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/path.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/path.cpp 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -214,7 +214,7 @@
// modifiers -----------------------------------------------------------------------//
- path& path::absolute(const path& base)
+ path& path::make_absolute(const path& base)
{
// store expensive to compute values that are needed multiple times
path this_root_name (root_name());
@@ -260,7 +260,7 @@
}
# ifdef BOOST_WINDOWS_PATH
- path & path::preferred()
+ path & path::make_preferred()
{
for (string_type::iterator it = m_pathname.begin();
it != m_pathname.end(); ++it)
Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -1062,9 +1062,9 @@
std::string s2(fs::initial_path().root_path().string()+"foo");
BOOST_TEST_EQ(s1, s2);
- BOOST_TEST(fs::path("x:/").absolute(fs::initial_path()).string()
+ BOOST_TEST(fs::path("x:/").make_absolute(fs::initial_path()).string()
== "x:/");
- BOOST_TEST(fs::path("x:/foo").absolute(fs::initial_path()).string()
+ BOOST_TEST(fs::path("x:/foo").make_absolute(fs::initial_path()).string()
== "x:/foo");
BOOST_TEST(fs::system_complete(fs::path(fs::initial_path().root_name()))
Modified: sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -1210,52 +1210,52 @@
// these are white box tests constructed with knowledge of execution paths
// *this.empty()
- BOOST_TEST_EQ(path().absolute("//foo/bar"), "//foo/bar");
+ BOOST_TEST_EQ(path().make_absolute("//foo/bar"), "//foo/bar");
if (platform == "Windows")
- BOOST_TEST_EQ(path().absolute("a:/bar"), "a:/bar");
+ BOOST_TEST_EQ(path().make_absolute("a:/bar"), "a:/bar");
// *this.has_root_name()
// *this.has_root_directory()
- BOOST_TEST_EQ(path("//foo/bar").absolute("//uvw/xyz"), "//foo/bar");
+ BOOST_TEST_EQ(path("//foo/bar").make_absolute("//uvw/xyz"), "//foo/bar");
if (platform == "Windows")
- BOOST_TEST_EQ(path("a:/bar").absolute("b:/xyz"), "a:/bar");
+ BOOST_TEST_EQ(path("a:/bar").make_absolute("b:/xyz"), "a:/bar");
// !*this.has_root_directory()
- BOOST_TEST_EQ(path("//net").absolute("//xyz/"), "//net/");
- BOOST_TEST_EQ(path("//net").absolute("//xyz/abc"), "//net/abc");
- BOOST_TEST_EQ(path("//net").absolute("//xyz/abc/def"), "//net/abc/def");
+ BOOST_TEST_EQ(path("//net").make_absolute("//xyz/"), "//net/");
+ BOOST_TEST_EQ(path("//net").make_absolute("//xyz/abc"), "//net/abc");
+ BOOST_TEST_EQ(path("//net").make_absolute("//xyz/abc/def"), "//net/abc/def");
if (platform == "Windows")
{
- BOOST_TEST_EQ(path("a:").absolute("b:/"), "a:/");
- BOOST_TEST_EQ(path("a:").absolute("b:/abc"), "a:/abc");
- BOOST_TEST_EQ(path("a:").absolute("b:/abc/def"), "a:/abc/def");
- BOOST_TEST_EQ(path("a:foo").absolute("b:/"), "a:/foo");
- BOOST_TEST_EQ(path("a:foo").absolute("b:/abc"), "a:/abc/foo");
- BOOST_TEST_EQ(path("a:foo").absolute("b:/abc/def"), "a:/abc/def/foo");
- BOOST_TEST_EQ(path("a:foo/bar").absolute("b:/"), "a:/foo/bar");
- BOOST_TEST_EQ(path("a:foo/bar").absolute("b:/abc"), "a:/abc/foo/bar");
- BOOST_TEST_EQ(path("a:foo/bar").absolute("b:/abc/def"), "a:/abc/def/foo/bar");
+ BOOST_TEST_EQ(path("a:").make_absolute("b:/"), "a:/");
+ BOOST_TEST_EQ(path("a:").make_absolute("b:/abc"), "a:/abc");
+ BOOST_TEST_EQ(path("a:").make_absolute("b:/abc/def"), "a:/abc/def");
+ BOOST_TEST_EQ(path("a:foo").make_absolute("b:/"), "a:/foo");
+ BOOST_TEST_EQ(path("a:foo").make_absolute("b:/abc"), "a:/abc/foo");
+ BOOST_TEST_EQ(path("a:foo").make_absolute("b:/abc/def"), "a:/abc/def/foo");
+ BOOST_TEST_EQ(path("a:foo/bar").make_absolute("b:/"), "a:/foo/bar");
+ BOOST_TEST_EQ(path("a:foo/bar").make_absolute("b:/abc"), "a:/abc/foo/bar");
+ BOOST_TEST_EQ(path("a:foo/bar").make_absolute("b:/abc/def"), "a:/abc/def/foo/bar");
}
// !*this.has_root_name()
// *this.has_root_directory()
- BOOST_TEST_EQ(path("/").absolute("//xyz/"), "//xyz/");
- BOOST_TEST_EQ(path("/").absolute("//xyz/abc"), "//xyz/");
- BOOST_TEST_EQ(path("/foo").absolute("//xyz/"), "//xyz/foo");
- BOOST_TEST_EQ(path("/foo").absolute("//xyz/abc"), "//xyz/foo");
+ BOOST_TEST_EQ(path("/").make_absolute("//xyz/"), "//xyz/");
+ BOOST_TEST_EQ(path("/").make_absolute("//xyz/abc"), "//xyz/");
+ BOOST_TEST_EQ(path("/foo").make_absolute("//xyz/"), "//xyz/foo");
+ BOOST_TEST_EQ(path("/foo").make_absolute("//xyz/abc"), "//xyz/foo");
// !*this.has_root_directory()
- BOOST_TEST_EQ(path("foo").absolute("//xyz/abc"), "//xyz/abc/foo");
- BOOST_TEST_EQ(path("foo/bar").absolute("//xyz/abc"), "//xyz/abc/foo/bar");
- BOOST_TEST_EQ(path(".").absolute("//xyz/abc"), "//xyz/abc/.");
- BOOST_TEST_EQ(path("..").absolute("//xyz/abc"), "//xyz/abc/..");
- BOOST_TEST_EQ(path("./foo").absolute("//xyz/abc"), "//xyz/abc/./foo");
- BOOST_TEST_EQ(path("../foo").absolute("//xyz/abc"), "//xyz/abc/../foo");
+ BOOST_TEST_EQ(path("foo").make_absolute("//xyz/abc"), "//xyz/abc/foo");
+ BOOST_TEST_EQ(path("foo/bar").make_absolute("//xyz/abc"), "//xyz/abc/foo/bar");
+ BOOST_TEST_EQ(path(".").make_absolute("//xyz/abc"), "//xyz/abc/.");
+ BOOST_TEST_EQ(path("..").make_absolute("//xyz/abc"), "//xyz/abc/..");
+ BOOST_TEST_EQ(path("./foo").make_absolute("//xyz/abc"), "//xyz/abc/./foo");
+ BOOST_TEST_EQ(path("../foo").make_absolute("//xyz/abc"), "//xyz/abc/../foo");
if (platform == "POSIX")
{
- BOOST_TEST_EQ(path("foo").absolute("/abc"), "/abc/foo");
- BOOST_TEST_EQ(path("foo/bar").absolute("/abc"), "/abc/foo/bar");
- BOOST_TEST_EQ(path(".").absolute("/abc"), "/abc/.");
- BOOST_TEST_EQ(path("..").absolute("/abc"), "/abc/..");
- BOOST_TEST_EQ(path("./foo").absolute("/abc"), "/abc/./foo");
- BOOST_TEST_EQ(path("../foo").absolute("/abc"), "/abc/../foo");
+ BOOST_TEST_EQ(path("foo").make_absolute("/abc"), "/abc/foo");
+ BOOST_TEST_EQ(path("foo/bar").make_absolute("/abc"), "/abc/foo/bar");
+ BOOST_TEST_EQ(path(".").make_absolute("/abc"), "/abc/.");
+ BOOST_TEST_EQ(path("..").make_absolute("/abc"), "/abc/..");
+ BOOST_TEST_EQ(path("./foo").make_absolute("/abc"), "/abc/./foo");
+ BOOST_TEST_EQ(path("../foo").make_absolute("/abc"), "/abc/../foo");
}
}
Modified: sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp 2010-02-22 19:31:01 EST (Mon, 22 Feb 2010)
@@ -409,15 +409,15 @@
// operator /
- CHECK(p1 / p2 == path("foo/bar").preferred());
- CHECK("foo" / p2 == path("foo/bar").preferred());
- CHECK(L"foo" / p2 == path("foo/bar").preferred());
- CHECK(string("foo") / p2 == path("foo/bar").preferred());
- CHECK(wstring(L"foo") / p2 == path("foo/bar").preferred());
- CHECK(p1 / "bar" == path("foo/bar").preferred());
- CHECK(p1 / L"bar" == path("foo/bar").preferred());
- CHECK(p1 / string("bar") == path("foo/bar").preferred());
- CHECK(p1 / wstring(L"bar") == path("foo/bar").preferred());
+ CHECK(p1 / p2 == path("foo/bar").make_preferred());
+ CHECK("foo" / p2 == path("foo/bar").make_preferred());
+ CHECK(L"foo" / p2 == path("foo/bar").make_preferred());
+ CHECK(string("foo") / p2 == path("foo/bar").make_preferred());
+ CHECK(wstring(L"foo") / p2 == path("foo/bar").make_preferred());
+ CHECK(p1 / "bar" == path("foo/bar").make_preferred());
+ CHECK(p1 / L"bar" == path("foo/bar").make_preferred());
+ CHECK(p1 / string("bar") == path("foo/bar").make_preferred());
+ CHECK(p1 / wstring(L"bar") == path("foo/bar").make_preferred());
swap(p1, p2);
@@ -471,18 +471,18 @@
{
std::cout << "testing modifiers..." << std::endl;
-// CHECK(path("").absolute("") == ""); // should assert
-// CHECK(path("").absolute("foo") == ""); // should assert
+// CHECK(path("").make_absolute("") == ""); // should assert
+// CHECK(path("").make_absolute("foo") == ""); // should assert
# ifdef BOOST_WINDOWS_PATH
- CHECK(path("baa").absolute("c:/") == "c:/baa");
- CHECK(path("/baa").absolute("c:/foo").string() == path("c:/baa").string());
- CHECK(path("baa/baz").absolute("c:/foo/bar").string()
+ CHECK(path("baa").make_absolute("c:/") == "c:/baa");
+ CHECK(path("/baa").make_absolute("c:/foo").string() == path("c:/baa").string());
+ CHECK(path("baa/baz").make_absolute("c:/foo/bar").string()
== path("c:/foo/bar\\baa/baz").string());
# else
- CHECK(path("baa").absolute("/") == "/baa");
- CHECK(path("/baa").absolute("/foo").string() == path("/baa").string());
- CHECK(path("baa/baz").absolute("/foo/bar").string()
+ CHECK(path("baa").make_absolute("/") == "/baa");
+ CHECK(path("/baa").make_absolute("/foo").string() == path("/baa").string());
+ CHECK(path("baa/baz").make_absolute("/foo/bar").string()
== path("/foo/bar/baa/baz").string());
# endif
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk