Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58226 - in sandbox/filesystem-v3: boost/filesystem libs/filesystem/doc libs/filesystem/src libs/filesystem/test libs/filesystem/test/msvc
From: bdawes_at_[hidden]
Date: 2009-12-07 14:52:18


Author: bemandawes
Date: 2009-12-07 14:52:16 EST (Mon, 07 Dec 2009)
New Revision: 58226
URL: http://svn.boost.org/trac/boost/changeset/58226

Log:
rename() specs now same as POSIX; fix #2866, but for V3 only
Text files modified:
   sandbox/filesystem-v3/boost/filesystem/operations.hpp | 8
   sandbox/filesystem-v3/libs/filesystem/doc/reference.html | 175 +++++++++++++++++++++++----------------
   sandbox/filesystem-v3/libs/filesystem/src/codecvt_error_category.cpp | 1
   sandbox/filesystem-v3/libs/filesystem/src/operations.cpp | 24 +---
   sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem-v3-sandbox.sln | 50 +++++++++++
   sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp | 37 +++++---
   sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp | 2
   7 files changed, 188 insertions(+), 109 deletions(-)

Modified: sandbox/filesystem-v3/boost/filesystem/operations.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/operations.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/operations.hpp 2009-12-07 14:52:16 EST (Mon, 07 Dec 2009)
@@ -195,7 +195,7 @@
     BOOST_FILESYSTEM_DECL
     boost::uintmax_t remove_all(const path& p, system::error_code* ec=0);
     BOOST_FILESYSTEM_DECL
- void rename(const path& from, const path& to, system::error_code* ec=0);
+ void rename(const path& old_p, const path& new_p, system::error_code* ec=0);
     BOOST_FILESYSTEM_DECL
     void resize_file(const path& p, uintmax_t size, system::error_code* ec=0);
     BOOST_FILESYSTEM_DECL
@@ -422,11 +422,11 @@
   boost::uintmax_t remove_all(const path& p, system::error_code& ec)
                                        {return detail::remove_all(p, &ec);}
   inline
- void rename(const path& from, const path& to) {detail::rename(from, to);}
+ void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);}
 
   inline
- void rename(const path& from, const path& to, system::error_code& ec)
- {detail::rename(from, to, &ec);}
+ void rename(const path& old_p, const path& new_p, system::error_code& ec)
+ {detail::rename(old_p, new_p, &ec);}
   inline // name suggested by Scott McMurray
   void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);}
 

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 2009-12-07 14:52:16 EST (Mon, 07 Dec 2009)
@@ -90,9 +90,9 @@
 &nbsp;&nbsp;&nbsp;&nbsp create_hard_link<br>
 &nbsp;&nbsp;&nbsp;&nbsp create_symlink<br>
 &nbsp;&nbsp;&nbsp;&nbsp current_path<br>
-&nbsp;&nbsp;&nbsp;&nbsp exists<br>
+&nbsp;&nbsp;&nbsp;&nbsp exists<br>
 &nbsp;&nbsp;&nbsp;&nbsp equivalent<br>
-&nbsp;&nbsp;&nbsp;&nbsp file_size<br>
+&nbsp;&nbsp;&nbsp;&nbsp file_size<br>
 &nbsp;&nbsp;&nbsp;&nbsp initial_path<br>
 &nbsp;&nbsp;&nbsp;&nbsp is_directory<br>
 &nbsp;&nbsp;&nbsp;&nbsp is_empty<br>
@@ -2141,16 +2141,16 @@
 <pre><span style="background-color: #FFFFFF; ">uintmax_t</span> <a name="file_size">file_size</a>(const path&amp; p);<span style="background-color: #FFFFFF; ">
 uintmax_t</span> <a name="file_size">file_size</a>(const path&amp; p, system::error_code&amp; ec);</pre>
 <blockquote>
- <p><i>Returns:</i> The size
+ <p><span style="background-color: #FFFF00">Remarks: </span></p>
+ <p><i>Returns:</i> If <code>exists(p) &amp;&amp; is_regular_file(p)</code>, the size
   <span style="background-color: #FFFFFF; ">in bytes</span>
   of the file <code>p</code> resolves to, determined as if by the value of
   the <i>POSIX</i> <code>
   <a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html">stat</a></code> structure member <code>st_size</code>
   obtained as if by <i>POSIX</i> <code>
- stat()</code>.</p>
- <p style="font-size: 10pt"><i>Throws:</i> <code>filesystem_error</code><span style="background-color: #FFFFFF">
- </span>if <code>!exists(p) || !is_regular_file(p)</code>,
- otherwise as specified in
+ stat()</code>.
+ Otherwise, <code>static_cast&lt;uintmax_t&gt;(-1)</code>.</p>
+ <p style="font-size: 10pt"><i>Throws:</i> As specified in
   <a href="file:///C:/boost/filesystem-v3-sandbox/libs/filesystem/doc/reference.html#Error-reporting">
   Error reporting</a>.</p>
 </blockquote>
@@ -2204,13 +2204,29 @@
   <code>s.type() == regular_file</code></p>
   <p><i>Throws:</i> Nothing.</p>
 </blockquote>
-<pre><code>bool <a name="is_regular_file2">is_regular_file</a>(const path&amp; p);
-bool <a name="is_regular_file2">is_regular_file</a>(const path&amp; p, system::error_code&amp; ec);</code></pre>
+<pre><code>bool <a name="is_regular_file2">is_regular_file</a>(const path&amp; p);</code></pre>
 <blockquote>
- <p><i>Returns:</i> <code>is_regular_file(status(p))</code> or <code>is_regular_file(status(p, ec))</code>,
- respectively.</p>
- <p><i>Throws:</i> <code>filesystem_error</code>; overload with <code>error_code&amp;</code> throws
- nothing.</p>
+ <p><i>Returns:</i> <code>is_regular_file(status(p))</code>.</p>
+ <p><i>Throws:</i> <code>filesystem_error</code>
+ if <code>status(p)</code> would throw <code>filesystem_error.</code></p>
+ </blockquote>
+<pre><code>bool <a name="is_regular_file2">is_regular_file</a>(const path&amp; p, system::error_code&amp; ec);</code></pre>
+<blockquote>
+ <p><i>Effects:</i> Sets <code>ec</code> as if by <code>status(p, ec)</code>.
+ <span style="background-color: #FFFF00">[</span><i><span style="background-color: #FFFF00">Note:</span></i><span style="background-color: #FFFF00">
+ </span>
+ <code><span style="background-color: #FFFF00">status_error</span></code><span style="background-color: #FFFF00">,
+ </span>
+ <code><span style="background-color: #FFFF00">file_not_found</span></code><span style="background-color: #FFFF00">
+ and </span>
+ <code><span style="background-color: #FFFF00">type_unknown</span></code><span style="background-color: #FFFF00">
+ cases set </span><code><span style="background-color: #FFFF00">ec</span></code><span style="background-color: #FFFF00">
+ to error values. To distinguish between cases, call the </span><code>
+ <span style="background-color: #FFFF00">status</span></code><span style="background-color: #FFFF00">
+ function directly. </span><i><span style="background-color: #FFFF00">-- end
+ note</span></i><span style="background-color: #FFFF00">] </span></p>
+ <p><i>Returns:</i> <code>is_regular_file(status(p, ec))</code>.</p>
+ <p><i>Throws:</i> Nothing.</p>
 </blockquote>
 <pre><span style="background-color: #FFFFFF">bool <a name="is_other">is_other</a>(file_status s);</span></pre>
 <blockquote>
@@ -2301,22 +2317,20 @@
   <a href="file:///C:/boost/filesystem-v3-sandbox/libs/filesystem/doc/reference.html#Error-reporting">
   Error reporting</a>.</p>
 </blockquote>
-<pre>void <a name="rename">rename</a>(const path&amp; from, const path&amp; to);
-void <a name="rename">rename</a>(const path&amp; from, const path&amp; to, system::error_code&amp; ec);</pre>
+<pre>void <a name="rename">rename</a>(const path&amp; old_p, const path&amp; new_p);
+void <a name="rename">rename</a>(const path&amp; old_p, const path&amp; new_p, system::error_code&amp; ec);</pre>
 <blockquote>
- <p><i>Effects:</i> Renames <code>from</code> to <code>to</code>, as if by
+ <p><i>Effects:</i> Renames <code>old_p</code> to <code>new_p</code>, as if by
   <i>POSIX</i> <code>
   <a href="http://www.opengroup.org/onlinepubs/000095399/functions/rename.html">
   rename()</a></code>.</p>
   <blockquote>
- <p>[<i>Note:</i> If <code>from</code> and <code>to</code> resolve to the
- same file, no action is taken. Otherwise, if <code>to</code> resolves to an
- existing file, it is removed. A symbolic link is itself renamed, rather than
+ <p>[<i>Note:</i> If <code>old_p</code> and <code>new_p</code> resolve to the
+ same existing file, no action is taken. Otherwise, if <code>new_p</code> resolves to an
+ existing non-directory file, it is removed, while if <code>new_p</code> resolves to an
+ existing directory, it is removed if empty on POSIX but is an error on Windows. A symbolic link is itself renamed, rather than
   the file it resolves to being renamed. <i>-- end note</i>]</p>
   </blockquote>
- <p><i>Postconditions:</i> <code>!exists(from) &amp;&amp; exists(to)</code>, and
- the contents and attributes of the file originally named <code>from</code>
- are otherwise unchanged.</p>
   <p><i>Throws:</i> As specified in
   <a href="file:///C:/boost/filesystem-v3-sandbox/libs/filesystem/doc/reference.html#Error-reporting">
   Error reporting</a>.</p>
@@ -2351,27 +2365,39 @@
   <a href="file:///C:/boost/filesystem-v3-sandbox/libs/filesystem/doc/reference.html#Error-reporting">
   Error reporting</a>.</p>
 </blockquote>
-<pre>file_status <a name="status">status</a>(const path&amp; p);
-file_status <a name="status">status</a>(const path&amp; p, system::error_code&amp; ec);</pre>
+<pre>file_status <a name="status">status</a>(const path&amp; p);</pre>
+<blockquote>
+ <p><i>Effects: </i>As if:</p>
+ <blockquote>
+ <pre>system::error_code ec;
+file_status result = status(p, ec);
+if (result == status_error)
+ throw filesystem_error(<i>implementation-supplied-message</i>, p, ec);
+return result;</pre>
+ </blockquote>
+ <p><i>Returns:</i> See above.</p>
+ <p><i>Throws:</i> <code>filesystem_error</code>.
+[<i>Note:</i> <code>result</code> values of <code>
+ file_status(file_not_found)</code>and <code>
+ file_status(type_unknown)</code> are not considered failures and do not
+ cause an exception to be
+thrown.<i> -- end note</i>] </p>
+ </blockquote>
+<pre>file_status <a name="status">status</a>(const path&amp; p, system::error_code&amp; ec);</pre>
 <blockquote>
   <p><i>Effects: </i></p>
   <blockquote>
- <p>Determines the attributes
- of
- <code>p</code> as if by<i> POSIX </i> <code>
+ <p>If possible, determines the attributes
+ of the file
+ <code>p</code> resolves to, as if by<i> POSIX </i> <code>
   <a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">stat()</a></code>.</p>
       <p>[<i>Note:</i> If a symbolic link is encountered during pathname
       resolution,
       pathname resolution continues using the contents of the symbolic link. <i>--
     end note</i>]</p>
- <p>For the <code>error_code&amp;</code> overload:</p>
- <ul>
- <li>If, during attribute determination, the underlying file system API reports no error, <code>ec.clear()</code>.<br>
-&nbsp;</li>
- <li>Otherwise, <code>ec</code> is set according to the error reported by
- the underlying file system API.</li>
- </ul>
- <blockquote>
+ If, during attribute determination, the underlying file system API reports
+ an error, sets <code>ec</code> to indicate the specific error reported.
+ Otherwise, <code>ec.clear()</code>.<blockquote>
       <p>[<i>Note:</i> This allows users to inspect the specifics of underlying
       API errors even when the value returned by <code>status()</code> is not <code>
       file_status(status_error)</code>.&nbsp; <i>--end note</i>]</p>
@@ -2379,58 +2405,69 @@
     </blockquote>
   <p><i>Returns:</i></p>
   <blockquote>
- <p>If the underlying file system API reported an error during attribute determination:</p>
+ <p>If <code>ec != error_code()</code>:</p>
     <ul>
- <li>If the error indicated that <code>p</code> could not be resolved, as
- if by POSIX errors ENOENT or ENOTDIR, return <code>
- file_status(file_not_found)</code>. [<i>Note:</i> Windows equivalents
+ <li>If the specific error indicates that <code>p</code> cannot be resolved
+ because some element of the path does not exist, return <code>
+ file_status(file_not_found)</code>. [<i>Note:</i> POSIX errors that
+ indicate this are ENOENT or ENOTDIR. Windows equivalents
       include ERROR_FILE_NOT_FOUND, ERROR_PATH_NOT_FOUND, ERROR_INVALID_NAME,
       ERROR_INVALID_PARAMETER, ERROR_BAD_PATHNAME, and ERROR_BAD_NETPATH. <i>--
       end note</i>]<br>
 &nbsp;</li>
- <li>Otherwise, if the error indicates that <code>p</code> can be resolved
+ <li>Otherwise, if the specific error indicates that <code>p</code> can be resolved
       but the attributes cannot be determined, return <code>
       file_status(type_unknown)</code>. [<i>Note: </i>For example, Windows
- ERROR_SHARING_VIOLATION errors. The case never arises on POSIX. <i>-- end
+ ERROR_SHARING_VIOLATION errors. For POSIX, the case never arises. <i>-- end
       note</i>]<br>
 &nbsp;</li>
- <li>Otherwise, for the overload without <code>error_code&amp;</code>,
- throw an exception of type <code>filesystem_error</code>.<br>
-&nbsp;</li>
       <li>Otherwise, return <code>
       file_status(status_error)</code>.</li>
     </ul>
+ <blockquote>
         <p>[<i>Note:</i> These semantics distinguish between
- <code>p</code> being known not to exist and not being able to determine the status of <code>p</code>. The
- distinction is important to some users.&nbsp; <i>--end note</i>]</p>
+ <code>p</code> being known not to exist,
+ <code>p</code> existing but not being able to determine its attributes,
+ and there being an error that prevents even knowing if
+ <code>p</code> exists. These
+ distinctions are important to some use cases.&nbsp;<i>--end note</i>]</p>
+ </blockquote>
     <p>Otherwise,</p>
     <ul>
- <li>If the attributes indicate a regular file, as if by <i>POSIX</i>&nbsp;S_ISREG(),
+ <li>If the attributes indicate a regular file, as if by <i>POSIX</i>&nbsp;S_ISREG(),
       return <code>
- file_status(regular_file)</code>.<br>
+ file_status(regular_file)</code>. [<i>Note:</i> <code>
+regular_file</code> implies appropriate <code>&lt;fstream&gt;</code> operations
+ would succeed, assuming no hardware, permission, access, or race condition
+ errors. Lack of
+<code>regular_file</code> does not necessarily imply <code>&lt;fstream&gt;</code> operations would
+fail on a directory.
+<i>-- end note</i>]<br>
 &nbsp;</li>
- <li>Otherwise, if the attributes indicate a directory, as if by <i>POSIX</i> S_ISDIR(),
+ <li>Otherwise, if the attributes indicate a directory, as if by <i>POSIX</i>
+ S_ISDIR(),
       return <code>
- file_status(directory_file)</code>.<br>
+ file_status(directory_file)</code>. [<i>Note:</i> <code>directory_file</code> implies <code>
+directory_iterator(p)</code>would succeed.
+<i>-- end note</i>]<br>
 &nbsp;</li>
- <li>Otherwise, if the attributes indicate a symbolic link, as if by <i>POSIX</i> S_ISLNK(),
- return <code>
- file_status(symlink_file)</code>. <i>[Note: </i>Only possible for <code>
- symlink_status</code>. <i>--end note]<br>
-&nbsp;</i></li>
- <li>Otherwise, if the attributes indicate a block special file, as if by <i>POSIX</i> S_ISBLK(),
+ <li>Otherwise, if the attributes indicate a block special file, as if by <i>POSIX</i>
+ S_ISBLK(),
       return <code>
       file_status(block_file)</code>.<br>
 &nbsp;</li>
- <li>Otherwise, if the attributes indicate a character special file, as if by <i>POSIX</i> S_ISCHR(),
+ <li>Otherwise, if the attributes indicate a character special file, as if by <i>POSIX</i>
+ S_ISCHR(),
       return <code>
       file_status(character_file)</code>.<br>
 &nbsp;</li>
- <li>Otherwise, if the attributes indicate a fifo or pipe file, as if by <i>POSIX</i> S_ISFIFO(),
+ <li>Otherwise, if the attributes indicate a fifo or pipe file, as if by <i>POSIX</i>
+ S_ISFIFO(),
       return <code>
       file_status(fifo_file)</code>.<br>
 &nbsp;</li>
- <li>Otherwise, if the attributes indicate a socket, as if by <i>POSIX</i> S_ISSOCK(),
+ <li>Otherwise, if the attributes indicate a socket, as if by <i>POSIX</i>
+ S_ISSOCK(),
       return <code>
       file_status(socket_file)</code>.<br>
 &nbsp;</li>
@@ -2438,16 +2475,7 @@
       file_status(type_unknown)</code>.</li>
     </ul>
     </blockquote>
-<p>[<i>Note:</i> <code>directory_file</code> implies <code>
-directory_iterator(p)</code>would succeed, and <code>
-regular_file</code> implies appropriate <code>&lt;fstream&gt;</code> operations would succeed,
-assuming no hardware, permission, access, or race
-condition errors. For <code>regular_file,</code> the converse is not true; lack of
-<code>regular_file</code> does not necessarily imply <code>&lt;fstream&gt;</code> operations would
-fail on a directory.
-<i>-- end note</i>]</p>
-<p><i>Throws:</i> <code>filesystem_error</code>; overload with <code>error_code&amp;</code> throws
-nothing.</p>
+<p><i>Throws:</i> Nothing.</p>
 </blockquote>
 <pre><span style="background-color: #FFFFFF">bool <a name="status_known">status_known</a>(file_status s);</span></pre>
 <blockquote>
@@ -2455,8 +2483,8 @@
   <code>s.type() != status_error</code></span></p>
   <p><i>Throws:</i> Nothing.</p>
 </blockquote>
-<pre>file_status <a name="symlink_status">symlink_status</a>(const path&amp; p);
-file_status <a name="symlink_status">symlink_status</a>(const path&amp; p, system::error_code&amp; ec);</pre>
+<pre><span style="background-color: #FFFF00">file_status</span><span style="background-color: #FFFF00"> </span><a name="symlink_status"><span style="background-color: #FFFF00">symlink_status</span></a><span style="background-color: #FFFF00">(const</span><span style="background-color: #FFFF00"> path&amp; p);
+</span><span style="background-color: #FFFF00">file_status</span><span style="background-color: #FFFF00"> </span><a name="symlink_status"><span style="background-color: #FFFF00">symlink_status</span></a><span style="background-color: #FFFF00">(const</span><span style="background-color: #FFFF00"> path&amp; p, </span><span style="background-color: #FFFF00">system::error_code</span><span style="background-color: #FFFF00">&amp; </span><span style="background-color: #FFFF00">ec</span><span style="background-color: #FFFF00">);</span></pre>
 <blockquote>
   <p><i>Effects:</i>&nbsp; Same as status(), above,
   except that the attributes
@@ -2470,7 +2498,8 @@
       <p>[<i>Note:</i> Pathname resolution is complete if <code>p</code> names a symbolic link. <i>--
     end note</i>]</p>
       </blockquote>
- <p><i>Returns:</i> Same as status(), above.</p>
+ <p><i>Returns:</i> Same as status(), above,<span style="background-color: #FFFF00">
+ except ....</span></p>
 <p><i>Throws:</i> <code>filesystem_error</code>; overload with <code>error_code&amp;</code> throws
 nothing.</p>
 </blockquote>
@@ -3265,7 +3294,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 -->23 November 2009<!--webbot bot="Timestamp" endspan i-checksum="40588" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->06 December 2009<!--webbot bot="Timestamp" endspan i-checksum="39744" --></p>
 
 </body>
 

Modified: sandbox/filesystem-v3/libs/filesystem/src/codecvt_error_category.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/codecvt_error_category.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/codecvt_error_category.cpp 2009-12-07 14:52:16 EST (Mon, 07 Dec 2009)
@@ -18,6 +18,7 @@
 #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>

Modified: sandbox/filesystem-v3/libs/filesystem/src/operations.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/operations.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/operations.cpp 2009-12-07 14:52:16 EST (Mon, 07 Dec 2009)
@@ -135,7 +135,7 @@
 # define BOOST_COPY_DIRECTORY(F,T)(!(::stat(from.c_str(), &from_stat)!= 0\
          || ::mkdir(to.c_str(),from_stat.st_mode)!= 0))
 # define BOOST_COPY_FILE(F,T,FailIfExistsBool)copy_file_api(F, T, FailIfExistsBool)
-# define BOOST_MOVE_FILE(F,T)(::rename(F, T)== 0)
+# define BOOST_MOVE_FILE(OLD,NEW)(::rename(OLD, NEW)== 0)
 # define BOOST_RESIZE_FILE(P,SZ)(::truncate(P, SZ)== 0)
 
 # define BOOST_ERROR_NOT_SUPPORTED ENOSYS
@@ -153,7 +153,7 @@
 # define BOOST_DELETE_FILE(P)(::DeleteFileW(P)!= 0)
 # define BOOST_COPY_DIRECTORY(F,T)(::CreateDirectoryExW(F, T, 0)!= 0)
 # define BOOST_COPY_FILE(F,T,FailIfExistsBool)(::CopyFileW(F, T, FailIfExistsBool)!= 0)
-# define BOOST_MOVE_FILE(F,T)(::MoveFileW(F, T)!= 0)
+# define BOOST_MOVE_FILE(OLD,NEW)(::MoveFileExW(OLD, NEW, MOVEFILE_REPLACE_EXISTING)!= 0)
 # define BOOST_RESIZE_FILE(P,SZ)(resize_file_api(P, SZ)!= 0)
 # define BOOST_READ_SYMLINK(P,T)
 
@@ -1088,7 +1088,7 @@
       {
         if (ec == 0)
           throw_exception(filesystem_error("boost::filesystem::read_symlink",
- p, errno, system_category));
+ p, error_code(errno, system_category)));
         else ec->assign(errno, system_category);
         break;
       }
@@ -1132,19 +1132,9 @@
   }
 
   BOOST_FILESYSTEM_DECL
- void rename(const path& from, const path& to, error_code* ec)
+ void rename(const path& old_p, const path& new_p, error_code* ec)
   {
-# ifdef BOOST_POSIX_API
-
- // POSIX is too permissive so must check
- error_code dummy;
- if (error(fs::exists(to, dummy),
- error_code(EEXIST, system_category),
- from, to, ec, "boost::filesystem::rename"))
- return;
-# endif
-
- error(!BOOST_MOVE_FILE(from.c_str(), to.c_str()), from, to, ec,
+ error(!BOOST_MOVE_FILE(old_p.c_str(), new_p.c_str()), old_p, new_p, ec,
       "boost::filesystem::rename");
   }
 
@@ -1275,7 +1265,7 @@
       }
       if (ec == 0)
         throw_exception(filesystem_error("boost::filesystem::status",
- p, errno, system_category));
+ p, error_code(errno, system_category)));
       return fs::file_status(fs::status_error);
     }
     if (ec != 0) ec->clear();;
@@ -1330,7 +1320,7 @@
       }
       if (ec == 0)
         throw_exception(filesystem_error("boost::filesystem::status",
- p, errno, system_category));
+ p, error_code(errno, system_category)));
       return fs::file_status(fs::status_error);
     }
     if (ec != 0) ec->clear();

Modified: sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem-v3-sandbox.sln
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem-v3-sandbox.sln (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem-v3-sandbox.sln 2009-12-07 14:52:16 EST (Mon, 07 Dec 2009)
@@ -52,6 +52,36 @@
                 {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
         EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut_errors", "tut_errors\tut_errors.vcproj", "{B2F3B52F-A143-4BE1-9636-7AC7F75E7B63}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+ {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut_i18n", "tut_i18n\tut_i18n.vcproj", "{CE7D7A5E-C747-4056-9908-20584923DAEB}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+ {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut_intro", "tut_intro\tut_intro.vcproj", "{B31E3591-B45E-4139-8675-60C2158A8160}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+ {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut_more", "tut_more\tut_more.vcproj", "{FC70A98E-428C-4B04-924F-9658969BA00C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+ {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut_path", "tut_path\tut_path.vcproj", "{F407A97C-703F-464B-BF23-5C1DBECF887A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+ {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+ EndProjectSection
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -113,6 +143,26 @@
                 {709A954B-4F1E-4375-A418-BCBFFE598715}.Debug|Win32.Build.0 = Debug|Win32
                 {709A954B-4F1E-4375-A418-BCBFFE598715}.Release|Win32.ActiveCfg = Release|Win32
                 {709A954B-4F1E-4375-A418-BCBFFE598715}.Release|Win32.Build.0 = Release|Win32
+ {B2F3B52F-A143-4BE1-9636-7AC7F75E7B63}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B2F3B52F-A143-4BE1-9636-7AC7F75E7B63}.Debug|Win32.Build.0 = Debug|Win32
+ {B2F3B52F-A143-4BE1-9636-7AC7F75E7B63}.Release|Win32.ActiveCfg = Release|Win32
+ {B2F3B52F-A143-4BE1-9636-7AC7F75E7B63}.Release|Win32.Build.0 = Release|Win32
+ {CE7D7A5E-C747-4056-9908-20584923DAEB}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CE7D7A5E-C747-4056-9908-20584923DAEB}.Debug|Win32.Build.0 = Debug|Win32
+ {CE7D7A5E-C747-4056-9908-20584923DAEB}.Release|Win32.ActiveCfg = Release|Win32
+ {CE7D7A5E-C747-4056-9908-20584923DAEB}.Release|Win32.Build.0 = Release|Win32
+ {B31E3591-B45E-4139-8675-60C2158A8160}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B31E3591-B45E-4139-8675-60C2158A8160}.Debug|Win32.Build.0 = Debug|Win32
+ {B31E3591-B45E-4139-8675-60C2158A8160}.Release|Win32.ActiveCfg = Release|Win32
+ {B31E3591-B45E-4139-8675-60C2158A8160}.Release|Win32.Build.0 = Release|Win32
+ {FC70A98E-428C-4B04-924F-9658969BA00C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FC70A98E-428C-4B04-924F-9658969BA00C}.Debug|Win32.Build.0 = Debug|Win32
+ {FC70A98E-428C-4B04-924F-9658969BA00C}.Release|Win32.ActiveCfg = Release|Win32
+ {FC70A98E-428C-4B04-924F-9658969BA00C}.Release|Win32.Build.0 = Release|Win32
+ {F407A97C-703F-464B-BF23-5C1DBECF887A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F407A97C-703F-464B-BF23-5C1DBECF887A}.Debug|Win32.Build.0 = Debug|Win32
+ {F407A97C-703F-464B-BF23-5C1DBECF887A}.Release|Win32.ActiveCfg = Release|Win32
+ {F407A97C-703F-464B-BF23-5C1DBECF887A}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

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 2009-12-07 14:52:16 EST (Mon, 07 Dec 2009)
@@ -548,12 +548,10 @@
   {
     std::cout << "rename_tests..." << std::endl;
 
- // rename() test case numbers refer to operations.htm#rename table
-
     fs::path file_ph(dir / "f1");
     BOOST_TEST(fs::exists(file_ph));
 
- // [case 1] make sure can't rename() a non-existent file
+ // error: rename a non-existent old file
     BOOST_TEST(!fs::exists(d1 / "f99"));
     BOOST_TEST(!fs::exists(d1 / "f98"));
     renamer n1a(d1 / "f99", d1 / "f98");
@@ -561,27 +559,38 @@
     renamer n1b(fs::path(""), d1 / "f98");
     BOOST_TEST(CHECK_EXCEPTION(n1b, ENOENT));
 
- // [case 2] rename() target.empty()
+ // error: rename an existing file to ""
     renamer n2(file_ph, "");
     BOOST_TEST(CHECK_EXCEPTION(n2, ENOENT));
 
- // [case 3] make sure can't rename() to an existent file or directory
+ // rename an existing file to an existent file
+ create_file(dir / "ff1", "ff1");
+ create_file(dir / "ff2", "ff2");
+ fs::rename(dir / "ff2", dir / "ff1");
+ BOOST_TEST(fs::exists(dir / "ff1"));
+ verify_file(dir / "ff1", "ff2");
+ BOOST_TEST(!fs::exists(dir / "ff2"));
+
+ // rename an existing file to itself
+ BOOST_TEST(fs::exists(dir / "f1"));
+ fs::rename(dir / "f1", dir / "f1");
+ BOOST_TEST(fs::exists(dir / "f1"));
+
+ // error: rename an existing directory to an existing non-empty directory
     BOOST_TEST(fs::exists(dir / "f1"));
     BOOST_TEST(fs::exists(d1 / "f2"));
- renamer n3a(dir / "f1", d1 / "f2");
- BOOST_TEST(CHECK_EXCEPTION(n3a, EEXIST));
     // several POSIX implementations (cygwin, openBSD) report ENOENT instead of EEXIST,
- // so we don't verify error type on the above test.
+ // so we don't verify error type on the following test.
     renamer n3b(dir, d1);
     BOOST_TEST(CHECK_EXCEPTION(n3b, 0));
 
- // [case 4A] can't rename() file to a nonexistent parent directory
+ // error: move existing file to a nonexistent parent directory
     BOOST_TEST(!fs::is_directory(dir / "f1"));
     BOOST_TEST(!fs::exists(dir / "d3/f3"));
     renamer n4a(dir / "f1", dir / "d3/f3");
     BOOST_TEST(CHECK_EXCEPTION(n4a, ENOENT));
 
- // [case 4B] rename() file in same directory
+ // rename existing file in same directory
     BOOST_TEST(fs::exists(d1 / "f2"));
     BOOST_TEST(!fs::exists(d1 / "f50"));
     fs::rename(d1 / "f2", d1 / "f50");
@@ -591,7 +600,7 @@
     BOOST_TEST(fs::exists(d1 / "f2"));
     BOOST_TEST(!fs::exists(d1 / "f50"));
 
- // [case 4C] rename() file d1/f2 to d2/f3
+ // move and rename an existing file to a different directory
     fs::rename(d1 / "f2", d2 / "f3");
     BOOST_TEST(!fs::exists(d1 / "f2"));
     BOOST_TEST(!fs::exists(d2 / "f2"));
@@ -601,14 +610,14 @@
     fs::rename(d2 / "f3", d1 / "f2");
     BOOST_TEST(fs::exists(d1 / "f2"));
 
- // [case 5A] rename() directory to nonexistent parent directory
+ // error: move existing directory to nonexistent parent directory
     BOOST_TEST(fs::exists(d1));
     BOOST_TEST(!fs::exists(dir / "d3/d5"));
     BOOST_TEST(!fs::exists(dir / "d3"));
     renamer n5a(d1, dir / "d3/d5");
     BOOST_TEST(CHECK_EXCEPTION(n5a, ENOENT));
 
- // [case 5B] rename() on directory
+ // rename existing directory
     fs::path d3(dir / "d3");
     BOOST_TEST(fs::exists(d1));
     BOOST_TEST(fs::exists(d1 / "f2"));
@@ -624,7 +633,7 @@
     BOOST_TEST(fs::exists(d1 / "f2"));
     BOOST_TEST(!fs::exists(d3));
 
- // [case 5C] rename() rename and move d1 to d2 / "d20"
+ // rename and move d1 to d2 / "d20"
     BOOST_TEST(fs::exists(d1));
     BOOST_TEST(!fs::exists(d2 / "d20"));
     BOOST_TEST(fs::exists(d1 / "f2"));

Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp 2009-12-07 14:52:16 EST (Mon, 07 Dec 2009)
@@ -41,7 +41,7 @@
 
     error_code ec;
 
- CHECK(file_size("no-such-file", ec) == 0);
+ CHECK(file_size("no-such-file", ec) == static_cast<boost::uintmax_t>(-1));
     CHECK(ec == errc::no_such_file_or_directory);
 
     CHECK(status("no-such-file") == file_status(file_not_found));


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