Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55979 - 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-09-02 14:29:40


Author: bemandawes
Date: 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
New Revision: 55979
URL: http://svn.boost.org/trac/boost/changeset/55979

Log:
Apply all current fixes from trunk. Clear out more BOOST_FILESYSTEM_NARROW_ONLY #ifdef's. Refine path append semantics, tests, refactor implementation. More support for deprecated features. Retest on Linux.
Text files modified:
   sandbox/filesystem-v3/boost/filesystem/config.hpp | 23 ++--
   sandbox/filesystem-v3/boost/filesystem/operations.hpp | 66 ++++++------
   sandbox/filesystem-v3/boost/filesystem/path.hpp | 126 ++++++++++++++++--------
   sandbox/filesystem-v3/boost/filesystem/path_traits.hpp | 22 +++
   sandbox/filesystem-v3/libs/filesystem/doc/index.htm | 11 -
   sandbox/filesystem-v3/libs/filesystem/doc/reference.html | 205 ++++++++++++++++++++++++++-------------
   sandbox/filesystem-v3/libs/filesystem/src/operations.cpp | 72 +++++++------
   sandbox/filesystem-v3/libs/filesystem/src/path.cpp | 40 ++++++-
   sandbox/filesystem-v3/libs/filesystem/src/portability.cpp | 4
   sandbox/filesystem-v3/libs/filesystem/test/convenience_test.cpp | 6 -
   sandbox/filesystem-v3/libs/filesystem/test/deprecated_test.cpp | 38 ++++++-
   sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem-v3-sandbox.sln | 14 ++
   sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp | 23 ++++
   sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp | 183 ++++++++++++++++++++++++-----------
   sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp | 23 ++--
   15 files changed, 570 insertions(+), 286 deletions(-)

Modified: sandbox/filesystem-v3/boost/filesystem/config.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/config.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/config.hpp 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -25,6 +25,12 @@
 #include <boost/config.hpp>
 #include <boost/detail/workaround.hpp>
 
+// BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------//
+
+# ifdef BOOST_FILESYSTEM_SOURCE
+# define BOOST_FILESYSTEM_DEPRECATED
+# endif
+
 // determine platform ----------------------------------------------------------------//
 
 // BOOST_POSIX_API or BOOST_WINDOWS_API specify which API to use
@@ -32,15 +38,15 @@
 # if defined( BOOST_WINDOWS_API ) && defined( BOOST_POSIX_API )
 # error both BOOST_WINDOWS_API and BOOST_POSIX_API are defined
 # elif !defined( BOOST_WINDOWS_API ) && !defined( BOOST_POSIX_API )
-# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(BOOST_NO_STD_WSTRING)
+# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
 # define BOOST_WINDOWS_API
 # else
 # define BOOST_POSIX_API
 # endif
 # endif
 
-# if defined( BOOST_WINDOWS_API ) && defined( BOOST_NO_STD_WSTRING )
-# error BOOST_WINDOWS_API can not be used when BOOST_NO_STD_WSTRING is defined
+# if defined( BOOST_NO_STD_WSTRING )
+# error Boost.Filesystem V3 and later requires std::wstring support
 # endif
 
 // BOOST_WINDOWS_PATH enables Windows path syntax recognition
@@ -49,19 +55,14 @@
 // that isn't possible for v3 because BOOST_WINDOWS_PATH requires wstring support
 
 # if !defined(BOOST_POSIX_PATH) && (defined(_WIN32) || defined(__WIN32__) || defined(WIN32) \
- || (defined(__CYGWIN__) && !defined(BOOST_NO_STD_WSTRING)))
+ || defined(__CYGWIN__))
 # define BOOST_WINDOWS_PATH
 # endif
 
-// narrow support only for badly broken compilers or libraries -----------------------//
-
-# if defined(BOOST_NO_STD_WSTRING) || defined(BOOST_NO_SFINAE) || defined(BOOST_NO_STD_LOCALE) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
-# define BOOST_FILESYSTEM_NARROW_ONLY
-# endif
-
 // enable dynamic linking on Windows -------------------------------------------------//
 
-# if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)) && defined(__BORLANDC__) && defined(__WIN32__)
+# if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)) \
+ && BOOST_WORKAROUND(__BORLANDC__, <0x610) && defined(__WIN32__)
 # error Dynamic linking Boost.Filesystem does not work for Borland; use static linking instead
 # endif
 

Modified: sandbox/filesystem-v3/boost/filesystem/operations.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/operations.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/operations.hpp 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -18,7 +18,6 @@
 * Scoped enum workaround for file_type.
 * Enable all BOOST_FILESYSTEM_NO_DEPRECATED code.
 * Vista symlink_status support.
-* Merge fixes from trunk
 * rename and remove really need to be renamed. If users says "using namespace boost::filesystem"
    and some header included stdio, there is just too much chance of silent error.
 * create_directories error handling.
@@ -37,6 +36,7 @@
 
 #include <boost/filesystem/path.hpp>
 
+#include <boost/detail/scoped_enum_emulation.hpp>
 #include <boost/system/error_code.hpp>
 #include <boost/system/system_error.hpp>
 #include <boost/shared_ptr.hpp>
@@ -109,11 +109,13 @@
   };
 
   inline bool status_known( file_status f ) { return f.type() != status_unknown; }
- inline bool exists( file_status f ) { return f.type() != status_unknown && f.type() != file_not_found; }
+ inline bool exists( file_status f ) { return f.type() != status_unknown
+ && f.type() != file_not_found; }
   inline bool is_regular_file(file_status f){ return f.type() == regular_file; }
   inline bool is_directory( file_status f ) { return f.type() == directory_file; }
   inline bool is_symlink( file_status f ) { return f.type() == symlink_file; }
- inline bool is_other( file_status f ) { return exists(f) && !is_regular_file(f) && !is_directory(f) && !is_symlink(f); }
+ inline bool is_other( file_status f ) { return exists(f) && !is_regular_file(f)
+ && !is_directory(f) && !is_symlink(f); }
 
 # ifndef BOOST_FILESYSTEM_NO_DEPRECATED
   inline bool is_regular( file_status f ) { return f.type() == regular_file; }
@@ -141,34 +143,21 @@
   file_status symlink_status( const path & p,
                       system::error_code & ec = throws() );
     
- inline bool exists( const path & p, system::error_code & ec = throws() ) { return exists( status( p, ec ) ); }
- inline bool is_directory( const path & p, system::error_code & ec = throws() ) { return is_directory( status( p, ec ) ); }
- inline bool is_regular_file( const path & p, system::error_code & ec = throws() ) { return is_regular_file( status( p, ec ) ); }
- inline bool is_other( const path & p, system::error_code & ec = throws() ) { return is_other( status( p, ec ) ); }
- inline bool is_symlink( const path & p, system::error_code & ec = throws() ) { return is_symlink( symlink_status( p, ec ) ); }
+ inline bool exists( const path & p, system::error_code & ec = throws() )
+ { return exists( status( p, ec ) ); }
+ inline bool is_directory( const path & p, system::error_code & ec = throws() )
+ { return is_directory( status( p, ec ) ); }
+ inline bool is_regular_file( const path & p, system::error_code & ec = throws() )
+ { return is_regular_file( status( p, ec ) ); }
+ inline bool is_other( const path & p, system::error_code & ec = throws() )
+ { return is_other( status( p, ec ) ); }
+ inline bool is_symlink( const path & p, system::error_code & ec = throws() )
+ { return is_symlink( symlink_status( p, ec ) ); }
 
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
- inline bool is_regular( const path & p, system::error_code & ec = throws() ) { return is_regular( status( p, ec ) ); }
-# endif
-
-
-// // VC++ 7.0 and earlier has a serious namespace bug that causes a clash
-// // between boost::filesystem::is_empty and the unrelated type trait
-// // boost::is_empty.
-//
-//# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300
-// BOOST_FS_FUNC(bool) is_empty( const Path & ph )
-//# else
-// BOOST_FS_FUNC(bool) _is_empty( const Path & ph )
-//# endif
-// {
-// detail::query_pair result(
-// detail::is_empty_api( ph.external_file_string() ) );
-// if ( result.first )
-// boost::throw_exception( basic_filesystem_error<Path>(
-// "boost::filesystem::is_empty", ph, result.first ) );
-// return result.second;
-// }
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+ inline bool is_regular( const path & p, system::error_code & ec = throws() )
+ { return is_regular( status( p, ec ) ); }
+# endif
 
   BOOST_FILESYSTEM_DECL
   bool is_empty( const path & p, system::error_code & ec = throws() );
@@ -199,10 +188,20 @@
   void copy_directory( const path & from, const path & to,
                        system::error_code & ec = throws() );
 
+ BOOST_SCOPED_ENUM_START(copy_option)
+ { fail_if_exists, overwrite_if_exists };
+ BOOST_SCOPED_ENUM_END
+
   BOOST_FILESYSTEM_DECL
   void copy_file( const path & from, const path & to,
+ BOOST_SCOPED_ENUM(copy_option) option, // See ticket #2925
                   system::error_code & ec = throws() );
 
+ inline
+ void copy_file( const path & from, const path & to,
+ system::error_code & ec = throws() )
+ { copy_file( from, to, copy_option::fail_if_exists, ec ); }
+
   BOOST_FILESYSTEM_DECL
   void copy_symlink( const path & from, const path & to,
                      system::error_code & ec = throws() );
@@ -270,6 +269,11 @@
   BOOST_FILESYSTEM_DECL
   space_info space( const path & p, system::error_code & ec = throws() );
 
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+ inline bool symbolic_link_exists( const path & ph )
+ { return is_symlink( symlink_status(ph) ); }
+# endif
+
   BOOST_FILESYSTEM_DECL
   path system_complete( const path & p, system::error_code & ec = throws() );
 
@@ -319,7 +323,7 @@
   file_status symlink_status( system::error_code & ec = throws() ) const;
 
   //// conversion simplifies the most common use of directory_entry
- // Removed; poor design + too likely to conflict with path v3 constructor templates
+ // Removed; poor design and too likely to conflict with path v3 constructor templates
   //operator const boost::filesystem::path &() const { return m_path; }
 
 //# ifndef BOOST_FILESYSTEM_NO_DEPRECATED

Modified: sandbox/filesystem-v3/boost/filesystem/path.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path.hpp 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -25,22 +25,16 @@
      reference.html#Path-decomposition-table needs rows for //, //netname, //netname/foo
      Make sure current trunk has passing tests for those cases, all decompositions.
      See test_decompositions() in path_unit_test.cpp
- * Get the deprecated names working.
    * Document leading //: no longer treated specially.
    * Document behavior of path::replace_extension has change WRT argument w/o a dot.
- * reference.html: operator /= is underspecified as to when a "/" is appended, and
- whether a '/' or '\' is appended.
    * Provide the name check functions for more character types? Templatize?
- * Why do preferred() and generic() return paths rather than const strings/string refs?
- Either change or document rationale.
    * Use BOOST_DELETED, BOOST_DEFAULTED, where appropriate.
    * Add test for scoped_path_locale.
+ * Add codepage 936/950/etc test cases.
      
                          Design Questions
 
 
- * Should path_locale use thread local storage?
- * Will locale overloads be needed in practice?
    * Is it OK for single-element decomposition functions to return paths? Yes;
      keep the interface simple and usable in generic code at the expense of some
      notational convenience.
@@ -52,7 +46,6 @@
      No. KISS. basic_string<char> is special because it is the predominent
      use case. w (and other) flavors can be added later.
    * Should UDT's be supported? Yes. Easy to do and pretty harmless.
- * Remove all support for environments that don't support wstring.
    * Should path iteration to a separator result in:
        -- the actual separator used
        -- the preferred separator
@@ -68,10 +61,8 @@
 #include <boost/system/error_code.hpp>
 #include <boost/system/system_error.hpp>
 #include <boost/iterator/iterator_facade.hpp>
-//#include <boost/utility/enable_if.hpp>
 #include <boost/throw_exception.hpp>
 #include <boost/shared_ptr.hpp>
-//#include <boost/type_traits/is_same.hpp>
 #include <boost/static_assert.hpp>
 #include <string>
 #include <cstring>
@@ -147,13 +138,10 @@
 
 # ifdef BOOST_WINDOWS_API
     typedef wchar_t value_type;
- static const wchar_t preferred_separator = L'\\';
 # else
     typedef char value_type;
- static const char preferred_separator = '/';
 # endif
     typedef std::basic_string<value_type> string_type;
- typedef string_type::size_type size_type;
     typedef path_traits::codecvt_type codecvt_type;
 
     // ----- character encoding conversions -----
@@ -271,30 +259,13 @@
     // if a separator is added, it is the preferred separator for the platform;
     // slash for POSIX, backslash for Windows
 
- path & operator/=( const path & p )
- {
- m_append_separator_if_needed();
- m_path += p.m_path;
- return *this;
- }
+ path & operator/=( const path & p );
 
     template <class ContiguousIterator>
- path & append( ContiguousIterator begin, ContiguousIterator end )
- {
- m_append_separator_if_needed();
- if ( begin != end )
- path_traits::convert( &*begin, &*begin+std::distance(begin, end),
- m_path, codecvt() );
- return *this;
- }
+ path & append( ContiguousIterator begin, ContiguousIterator end );
 
     template <class PathSource>
- path & operator/=( PathSource const & range )
- {
- m_append_separator_if_needed();
- path_traits::dispatch( range, m_path, codecvt() );
- return *this;
- }
+ path & operator/=( PathSource const & range );
 
     // ----- modifiers -----
 
@@ -305,18 +276,14 @@
 
 # ifdef BOOST_WINDOWS_API
 
- path & path::localize(); // change slash to backslash
+ path & localize(); // change slash to backslash
 
 # else // BOOST_POSIX_API
 
- path & path::localize() { return *this; } // POSIX m_path already localized
+ path & localize() { return *this; } // POSIX m_path already localized
 
 # endif
 
-//# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-// path & normalize() { return m_normalize(); }
-//# endif
-
     // ----- observers -----
   
     // For operating systems that format file paths differently than directory
@@ -379,7 +346,7 @@
 # else // BOOST_POSIX_API
 
     const std::string & string() const { return m_path; }
- const std::wstring wstring() const;
+ const std::wstring wstring() const { return native_wstring(); }
 
 # endif
 
@@ -432,6 +399,43 @@
     iterator begin() const;
     iterator end() const;
 
+ // ----- deprecated functions -----
+
+# if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED)
+# error both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined
+# endif
+
+# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
+ // recently deprecated functions supplied by default
+ path & remove_leaf() { return remove_filename(); }
+ path leaf() const { return filename(); }
+ path branch_path() const { return parent_path(); }
+ bool has_leaf() const { return !m_path.empty(); }
+ bool has_branch_path() const { return !parent_path().empty(); }
+# endif
+
+# if defined(BOOST_FILESYSTEM_DEPRECATED)
+ // deprecated functions with enough signature or semantic changes that they are
+ // not supplied by default
+ const std::string file_string() const { return native_string(); }
+ const std::string directory_string() const { return native_string(); }
+ const std::string native_file_string() const { return native_string(); }
+ const std::string native_directory_string() const { return native_string(); }
+ const string_type external_file_string() const { return native(); }
+ const string_type external_directory_string() const { return native(); }
+
+ // older functions no longer supported
+ //typedef bool (*name_check)( const std::string & name );
+ //basic_path( const string_type & str, name_check ) { operator/=( str ); }
+ //basic_path( const typename string_type::value_type * s, name_check )
+ // { operator/=( s );}
+ //static bool default_name_check_writable() { return false; }
+ //static void default_name_check( name_check ) {}
+ //static name_check default_name_check() { return 0; }
+ //basic_path & canonize();
+ //basic_path & normalize();
+# endif
+
 //--------------------------------------------------------------------------------------//
 // class path private members //
 //--------------------------------------------------------------------------------------//
@@ -448,7 +452,12 @@
     string_type m_path; // Windows: as input; backslashes NOT converted to slashes,
                           // slashes NOT converted to backslashes
 
- void m_append_separator_if_needed();
+ string_type::size_type m_append_separator_if_needed();
+ // Returns: If separator is to be appended, m_path.size() before append. Otherwise 0.
+ // Note: An append is never performed if size()==0, so a returned 0 is unambiguous.
+
+ void m_erase_redundant_separator( string_type::size_type sep_pos );
+
     void m_portable();
 
     //path & m_normalize();
@@ -469,6 +478,10 @@
 
   }; // class path
 
+# if defined(BOOST_FILESYSTEM_DEPRECATED)
+ typedef path wpath;
+# endif
+
   //------------------------------------------------------------------------------------//
   // class path::iterator //
   //------------------------------------------------------------------------------------//
@@ -619,6 +632,37 @@
   BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name );
   BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name );
   BOOST_FILESYSTEM_DECL bool native( const std::string & name );
+
+//--------------------------------------------------------------------------------------//
+// class path member template implementation //
+//--------------------------------------------------------------------------------------//
+
+ template <class ContiguousIterator>
+ path & path::append( ContiguousIterator begin, ContiguousIterator end )
+ {
+ if ( begin == end )
+ return *this;
+ string_type::size_type sep_pos( m_append_separator_if_needed() );
+ if ( begin != end )
+ path_traits::convert( &*begin, &*begin+std::distance(begin, end),
+ m_path, codecvt() );
+ if ( sep_pos )
+ m_erase_redundant_separator( sep_pos );
+ return *this;
+ }
+
+ template <class PathSource>
+ path & path::operator/=( PathSource const & range )
+ {
+ if ( path_traits::empty( range ) )
+ return *this;
+ string_type::size_type sep_pos( m_append_separator_if_needed() );
+ path_traits::dispatch( range, m_path, codecvt() );
+ if ( sep_pos )
+ m_erase_redundant_separator( sep_pos );
+ return *this;
+ }
+
 
 } // namespace filesystem
 } // namespace boost

Modified: sandbox/filesystem-v3/boost/filesystem/path_traits.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path_traits.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path_traits.hpp 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -64,7 +64,24 @@
  
   typedef std::codecvt<wchar_t, char, std::mbstate_t> codecvt_type;
 
- // Pathable dispatchers
+ // Pathable empty
+
+ template <class Container> inline
+ bool empty( const Container & c )
+ { return c.begin() == c.end(); }
+
+ template <class T> inline
+ bool empty( T * const & c_str )
+ {
+ BOOST_ASSERT( c_str );
+ return !*c_str;
+ }
+
+ template <typename T, size_t N> inline
+ bool empty( T (&array)[N] )
+ { return N <= 1; }
+
+ // Pathable dispatch
 
   template <class Container, class U> inline
   void dispatch( const Container & c, U & to, const codecvt_type & cvt )
@@ -77,7 +94,8 @@
   template <class T, class U> inline
   void dispatch( T * const & c_str, U & to, const codecvt_type & cvt )
   {
-// std::cout << "dispatch() const T *\n";
+// std::cout << "dispatch() const T *\n";
+ BOOST_ASSERT( c_str );
     convert( c_str, to, cvt );
   }
   

Modified: sandbox/filesystem-v3/libs/filesystem/doc/index.htm
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/index.htm (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/index.htm 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -337,22 +337,17 @@
     <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">Boost.System library is dynamically linked. If not defined,
+ <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.System library does not use the Boost auto-link
+ <td valign="top">Boost.Filesystem library does not use the Boost auto-link
     facility.</td>
   </tr>
   <tr>
- <td valign="top"><code>BOOST_FILESYSTEM_NARROW_ONLY</code></td>
- <td valign="top">Not defined.</td>
- <td valign="top">Removes features that require wchar_t support.</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.</td>
@@ -804,7 +799,7 @@
 
 <hr>
 <p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->28 October, 2008<!--webbot bot="Timestamp" endspan i-checksum="39203" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->01 September, 2009<!--webbot bot="Timestamp" endspan i-checksum="39345" --></p>
 
 <p>&copy; Copyright Beman Dawes, 2002-2005</p>
 <p> Use, modification, and distribution are subject to the Boost Software

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-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -48,7 +48,7 @@
     Header &lt;filesystem&gt; synopsis</a><br>
     <a href="#Path-traits">Path traits</a><br>
     <a href="#Class-template-path">
- Class template path</a><br>
+ Class path</a><br>
     &nbsp;&nbsp;&nbsp;
 <a href="#Pathname-formats">Pathname formats</a><br>
     &nbsp;&nbsp;&nbsp;
@@ -57,7 +57,7 @@
 <a href="#Input-conversion">Filename conversion</a><br>
     &nbsp;&nbsp;&nbsp;
 <a href="#path-requirements">Requirements</a> </td>
- <td width="35%" valign="top">&nbsp;Class template path (continued)<br>
+ <td width="35%" valign="top">&nbsp;Class path (continued)<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <a href="#path-requirements">path constructors</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@@ -71,6 +71,8 @@
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <a href="#path-iterators">path iterators</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ path deprecated functions<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <a href="#path-non-member-functions">path non-member functions</a><br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <a href="#path-inserter-extractor">path inserter and extractor</a><span style="background-color: #FFFFFF"><br>
@@ -343,12 +345,19 @@
         uintmax_t free;
         uintmax_t available;
       };
-</span>
- // status functions
- file_status status(const path&amp; p);
- file_status status(const path&amp; p, error_code&amp; ec);
- file_status symlink_status(const path&amp; p);
- file_status symlink_status(const path&amp; p, error_code&amp; ec);
+
+ BOOST_SCOPED_ENUM_START(<a name="copy_option">copy_option</a>)
+ {
+ fail_if_exists,
+ overwrite_if_exists
+ };
+ BOOST_SCOPED_ENUM_END
+
+</span> // status functions
+ file_status status(const path&amp; p,
+ system::error_code &amp; ec = throws());
+ file_status symlink_status(const path&amp; p,
+ system::error_code &amp; ec = throws());
 
       // predicate functions
       bool status_known( file_status s );
@@ -358,34 +367,56 @@
       bool is_symlink( file_status s );
       bool is_other( file_status s );
 
- bool exists(const path&amp; p);
- bool is_directory(const path&amp; p);
- bool is_regular_file(const path&amp; p);
- bool is_other(const path&amp; p);
- bool is_symlink(const path&amp; p);
- bool is_empty(const path&amp; p);
+ bool exists(const path&amp; p,
+ system::error_code &amp; ec = throws());
+ bool is_directory(const path&amp; p,
+ system::error_code &amp; ec = throws());
+ bool is_regular_file(const path&amp; p,
+ system::error_code &amp; ec = throws());
+ bool is_other(const path&amp; p,
+ system::error_code &amp; ec = throws());
+ bool is_symlink(const path&amp; p,
+ system::error_code &amp; ec = throws());
+ bool is_empty(const path&amp; p,
+ system::error_code &amp; ec = throws());
 
- bool equivalent(const path&amp; p1, const path&amp; p2);
+ bool equivalent(const path&amp; p1, const path&amp; p2, system::error_code &amp; ec = throws());
 
       // attribute functions
- path current_path();
- void current_path(const path&amp; p);
- const path&amp; initial_path();
- <span style="background-color: #FFFFFF; ">uintmax_t</span> file_size(const path&amp; p);
-<span style="background-color: #FFFFFF"> space_info space(const path&amp; p);</span><span style="background-color: #FFFF00">
-</span> std::time_t last_write_time(const path&amp; p);
- void last_write_time(const path&amp; p, const std::time_t new_time);
+ path current_path(system::error_code &amp; ec = throws());
+ void current_path(const path&amp; p,
+ system::error_code &amp; ec = throws());
+ const path&amp; initial_path(system::error_code &amp; ec = throws());
+ <span style="background-color: #FFFFFF; ">uintmax_t</span> file_size(const path&amp; p,
+ system::error_code &amp; ec = throws());
+<span style="background-color: #FFFFFF"> space_info space(const path&amp; p</span>,
+ system::error_code &amp; ec = throws()<span style="background-color: #FFFFFF">);</span><span style="background-color: #FFFF00">
+</span> std::time_t last_write_time(const path&amp; p,
+ system::error_code &amp; ec = throws());
+ void last_write_time(const path&amp; p, const std::time_t new_time,
+ system::error_code &amp; ec = throws());
 
       // operations functions
- bool create_directory(const path&amp; p);
- void create_hard_link(const path&amp; old, const path&amp; new_link);
-<span style="background-color: #FFFFFF"> void create_symlink(const path&amp; old, const path&amp; new_link);
-</span> bool remove_path(const path&amp; p);
- void rename_path(const path&amp; old, const path&amp; new_p);
- void copy_file(const path&amp; from, const path&amp; to);
- path system_complete(const path&amp; p);
- path complete(const path&amp; p, const path base=initial_path());
-
+ bool create_directory(const path&amp; p,
+ system::error_code &amp; ec = throws());
+ void create_hard_link(const path&amp; old, const path&amp; new_link,
+ system::error_code &amp; ec = throws());
+<span style="background-color: #FFFFFF"> void create_symlink(const path&amp; old, const path&amp; new_link</span>,
+ system::error_code &amp; ec = throws()<span style="background-color: #FFFFFF">);
+</span> bool <span style="background-color: #FFFF00">remove_path</span>(const path&amp; p,
+ system::error_code &amp; ec = throws());
+ void <span style="background-color: #FFFF00">rename_path</span>(const path&amp; old, const path&amp; new_p,
+ system::error_code &amp; ec = throws());
+ void copy_file( const path &amp; from, const path &amp; to,
+ BOOST_SCOPED_ENUM(copy_option) option,
+ system::error_code &amp; ec = throws() );
+ void copy_file( const path &amp; from, const path &amp; to,
+ system::error_code &amp; ec = throws() )
+ path system_complete(const path&amp; p,
+ system::error_code &amp; ec = throws());
+<span style="background-color: #FFFF00"> path </span><span style="background-color: #FFFF00">complete(const</span><span style="background-color: #FFFF00"> path&amp; p,
+ const path base=</span><span style="background-color: #FFFF00">initial_path</span><span style="background-color: #FFFF00">());
+</span>
       // convenience functions
       bool create_directories(const path&amp; p);
       typename Path::string_type extension(const path&amp; p);
@@ -505,14 +536,8 @@
       public:
         typedef <b><i>see below</i></b> value_type; // char for POSIX, wchar_t for Windows
         typedef std::basic_string&lt;value_type&gt; string_type;
- typedef string_type::size_type size_type;
         typedef path_traits::codecvt_type codecvt_type;
 
- static const value_type generic_separator = <b><i>see below</i></b>; // '/' for POSIX
- // L'/' for Windows
- static const value_type preferred_separator = <b><i>see below</i></b>; // '/' for POSIX
- // L'\\' for Windows
-
         // constructors/destructor
         path();
         path(const path&amp; p);
@@ -836,8 +861,14 @@
   <p><i>Postconditions:</i> <code>native()</code> contains:</p>
   <ul>
     <li>the original contents of <code>native()</code>, </li>
- <li>followed by a <code>native_separator</code>, unless an added separator
- would be redundant or would change an incomplete path to a complete path,</li>
+ <li>followed by an added native separator, unless:<ul>
+ <li>an added separator
+ would be redundant, or</li>
+ <li>would change an incomplete path to a complete path, or</li>
+ <li><code>p.empty()</code>, or</li>
+ <li><code>*p.native().cbegin()</code> is a separator,</li>
+ </ul>
+ </li>
     <li>followed by <code>p.native()</code>.</li>
   </ul>
 </blockquote>
@@ -849,8 +880,14 @@
   <p><i>Postconditions:</i> <code>native()</code> contains:</p>
   <ul>
     <li>the original contents of <code>native()</code>, </li>
- <li>followed by a <code>native_separator</code>, unless an added separator
- would be redundant or would change an incomplete path to a complete path,</li>
+ <li>followed by an added native separator, unless:<ul>
+ <li>an added separator
+ would be redundant, or</li>
+ <li>would change an incomplete path to a complete path, or</li>
+ <li><code>source</code> is empty, or</li>
+ <li><code>source</code> begins with a separator,</li>
+ </ul>
+ </li>
     <li>followed by a copy of [<code>begin</code>,<code>end</code>) or <code>source</code>, converted to the
   format and encoding required by the host operating system (<a href="#Input-conversion">Input
   conversion</a>).</li>
@@ -950,7 +987,7 @@
 <p><i>[Note:</i> For Windows implementations, no conversion is required; the
 implementation will simply return <code>native()</code>. <i>-- end note]</i></p>
 </blockquote>
-<pre><b><i>const-string</i></b> generic_string() const;</pre>
+<pre><b><i>const-string</i></b> string() const;</pre>
 <blockquote>
 <p><b><i><code>const-string</code></i></b> is permitted to be <code>const
 std::string</code> or <code>const std::string&amp;</code>.</p>
@@ -958,7 +995,7 @@
 representation</a> of the contents of <code>native()</code>. If <code>value_type</code>
 is not <code>char</code>, the encoding is converted by <code>codecvt()</code>.</p>
 </blockquote>
-<pre><b><i>const-wstring</i></b> generic_wstring() const;</pre>
+<pre><b><i>const-wstring</i></b> wstring() const;</pre>
 <blockquote>
 <p><b><i><code>const-wstring</code></i></b> is permitted to be <code>const
 std::wstring</code> or <code>const std::wstring&amp;</code>.</p>
@@ -1083,6 +1120,35 @@
 <blockquote>
   <p><i>Returns:</i> The end iterator.</p>
 </blockquote>
+<h4> <code><font size="4">class <a name="path-deprecated-functions">path</a></font></code><a name="path-deprecated-functions">
+deprecated functions</a></h4>
+<p> <span style="background-color: #FFFF00">index.htm</span><span style="background-color: #FFFF00">
+also has a section (see macros) partially duplicating this material. Change to
+reference this.</span></p>
+<p> Several member functions from previous versions of <code>class path</code>
+have been deprecated, either because they have been renamed or because the
+functionality is no longer desirable or has become obsolete.</p>
+<p> Deprecated functions available by default; will be suppressed if <code>
+BOOST_FILESYSTEM_NO_DEPRECATED</code> is defined:</p>
+<blockquote>
+ <pre>path&amp; remove_leaf() { return remove_filename(); }
+path leaf() const { return filename(); }
+path branch_path() const { return parent_path(); }
+bool has_leaf() const { return !m_path.empty(); }
+bool has_branch_path() const { return !parent_path().empty(); }</pre>
+</blockquote>
+<p> Deprecated functions not available by default; will be supplied if <code>
+BOOST_FILESYSTEM_DEPRECATED</code> is defined:</p>
+<blockquote>
+ <pre>const std::string file_string() const { return native_string(); }
+const std::string directory_string() const { return native_string(); }
+const std::string native_file_string() const { return native_string(); }
+const std::string native_directory_string() const { return native_string(); }
+const string_type external_file_string() const { return native(); }
+const string_type external_directory_string() const { return native(); }</pre>
+</blockquote>
+<p>Functions no longer available:</p>
+<p><span style="background-color: #FFFF00">TBS</span></p>
 <h4> <a name="path-non-member-functions">
 <span style="background-color: #FFFFFF">path non-member functions</span></a></h4>
 <pre><span style="background-color: #FFFFFF">template&lt;class String, class Traits&gt;
@@ -2040,10 +2106,8 @@
   directory_iterator&lt;Path&gt;(p) == directory_iterator&lt;Path&gt;()<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : file_size(p) == 0;</code></p>
 </blockquote>
-<pre><code>template &lt;class path, class path&gt; bool <a name="equivalent">equivalent</a>(const path&amp; p1, const path&amp; p2);</code></pre>
+<pre><code>bool <a name="equivalent">equivalent</a>(const path&amp; p1, const path&amp; p2);</code></pre>
 <blockquote>
- <p><i>Requires:</i> <code>path::external_string_type</code> and <code>
- path::external_string_type</code> are the same type. </p>
   <p><i>Effects:</i> Determines <code>file_status s1</code> and <code>s2</code>,
   as if by <code>status(p1)</code> and&nbsp; <code>status(p2)</code>,
   respectively.</p>
@@ -2088,7 +2152,7 @@
   encouraged to call it immediately on entrance to <code>main()</code> so that
   they will work correctly with such partial implementations. <i>--end note</i>]</p>
 </blockquote>
-<pre>Path current_path();</pre>
+<pre>path current_path();</pre>
 <blockquote>
   <p><i>Returns:</i> The current path, as if by <i>POSIX</i>
   <a href="http://www.opengroup.org/onlinepubs/000095399/functions/getcwd.html">
@@ -2116,7 +2180,7 @@
   obtained as if by <i>POSIX</i> <code>
   <a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">stat()</a></code>.</p>
 </blockquote>
-<pre><span style="background-color: #FFFFFF"><a name="space">template</a> &lt;class Path&gt; space_info space(const path&amp; p);</span></pre>
+<pre><span style="background-color: #FFFFFF">space_info space(const path&amp; p);</span></pre>
 <blockquote>
   <p><span style="background-color: #FFFFFF"><i>Returns:</i> A <code>space_info</code>
   object. The value of the <code>space_info</code> object is determined as if by
@@ -2162,8 +2226,7 @@
   <p><i>Returns:</i> True if a new directory was created, otherwise false.</p>
   <p><i>Postcondition:</i> <code>is_directory(dp)</code></p>
 </blockquote>
-<pre><span style="background-color: #FFFFFF">template &lt;class path, class path&gt;
- error_code create_hard_link(const path&amp; to_p, const path&amp; from_p, error_code&amp; ec);</span></pre>
+<pre><span style="background-color: #FFFFFF">void create_hard_link(const path&amp; to_p, const path&amp; from_p, error_code&amp; ec);</span></pre>
 <blockquote>
   <p><i><span style="background-color: #FFFFFF">Requires:</span></i><span style="background-color: #FFFFFF">
   </span> <code><span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> and
@@ -2174,9 +2237,6 @@
   </span> <code>
   <a href="http://www.opengroup.org/onlinepubs/000095399/functions/link.html">
   <span style="background-color: #FFFFFF">link()</span></a></code><span style="background-color: #FFFFFF">.</span></p>
- <p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF"> If the
- postcondition cannot be established, a system error code
- indicating the reason for the failure, otherwise 0.</span></p>
   <p><i><span style="background-color: #FFFFFF">Postcondition:</span></i></p>
   <ul>
     <li><span style="background-color: #FFFFFF">&nbsp;</span><code><span style="background-color: #FFFFFF">exists(to_p) &amp;&amp; exists(from_p) &amp;&amp; equivalent(to_p,
@@ -2195,8 +2255,7 @@
   for example. Thus hard links should be avoided if wide portability is
   a concern. </span> <i><span style="background-color: #FFFFFF">-- end note</span></i><span style="background-color: #FFFFFF">]</span></p>
   </blockquote>
-<pre><span style="background-color: #FFFFFF">template &lt;class path, class path&gt;
- void create_hard_link(const path&amp; to_p, const path&amp; from_p);</span></pre>
+<pre><span style="background-color: #FFFFFF">void create_hard_link(const path&amp; to_p, const path&amp; from_p);</span></pre>
 <blockquote>
   <p><i><span style="background-color: #FFFFFF">Requires:</span></i><span style="background-color: #FFFFFF">
   </span> <code><span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> and
@@ -2208,8 +2267,7 @@
   </span> <code>basic_filesystem_error&lt;path, path&gt;</code><span style="background-color: #FFFFFF">
   if <code>ec</code> is not zero.</span></p>
   </blockquote>
-<pre><span style="background-color: #FFFFFF">template &lt;class path, class path&gt;
- error_code create_symlink(const path&amp; to_p, const path&amp; from_p, error_code&amp; ec);</span></pre>
+<pre><span style="background-color: #FFFFFF">void create_symlink(const path&amp; to_p, const path&amp; from_p, error_code&amp; ec);</span></pre>
 <blockquote>
   <p><i><span style="background-color: #FFFFFF">Requires:</span></i><span style="background-color: #FFFFFF">
   </span> <code><span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> and
@@ -2232,8 +2290,7 @@
   them only for regular files. Thus symbolic links should be avoided if code portability is
   a concern. </span> <i><span style="background-color: #FFFFFF">-- end note</span></i><span style="background-color: #FFFFFF">]</span></p>
   </blockquote>
-<pre><span style="background-color: #FFFFFF">template &lt;class path, class path&gt;
- void create_symlink(const path&amp; to_p, const path&amp; from_p);</span></pre>
+<pre><span style="background-color: #FFFFFF">void create_symlink(const path&amp; to_p, const path&amp; from_p);</span></pre>
 <blockquote>
   <p><i><span style="background-color: #FFFFFF">Requires:</span></i><span style="background-color: #FFFFFF">
   </span> <code><span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> and
@@ -2295,17 +2352,25 @@
   existing file, it is removed. A symbolic link is itself renamed, rather than
   the file it resolves to being renamed. <i>-- end note</i>]</p>
 </blockquote>
-<pre>template &lt;class path, class path&gt; void copy_file(const path&amp; from_fp, const path&amp; to_fp);</pre>
+<pre>void copy_file(const path &amp; from, const path &amp; to,
+ BOOST_SCOPED_ENUM(copy_option) option,
+ system::error_code &amp; ec = throws());</pre>
 <blockquote>
- <p><i>Requires:</i> <code>path::external_string_type</code> and <code>
- path::external_string_type</code> are the same type. </p>
- <p><i>Effects:</i> The contents and attributes of the file <code>from_fp</code>
- resolves to are copied to the file <code>to_fp</code> resolves to.</p>
+ <p><i>Effects:</i> The contents and attributes of the file <code>from</code>
+ resolves to are copied to the file <code>to</code> resolves to.</p>
   <p><i>Throws:</i> <code>basic_filesystem_error&lt;Path&gt;</code> if <code>
- from_fp.empty() || to_fp.empty() ||!exists(from_fp) || !is_regular_file(from_fp)
- || exists(to_fp)</code></p>
+ from.empty() || to.empty() ||!exists(from) || !is_regular_file(from) ||
+ (option==copy_option::fail_if_exists
+ &amp;&amp; exists(to))</code></p>
+</blockquote>
+<pre>void copy_file(const path &amp; from, const path &amp; to,
+ system::error_code &amp; ec = throws());</pre>
+<blockquote>
+ <p><i>Effects:</i><code>copy_file(from, to,
+ copy_option::fail_if_exists, ec)</code>.</p>
+
 </blockquote>
-<pre>Path complete(const path&amp; p, const path base=initial_path&lt;Path&gt;());</pre>
+<pre>path complete(const path&amp; p, const path&amp; base=initial_path());</pre>
 <blockquote>
   <p><i>Effects:</i> Composes a complete path from <code>p</code> and <code>base</code>,
   using the following rules:</p>
@@ -2344,7 +2409,7 @@
   is expected by program users. <i>--
   end note</i>]</p>
 </blockquote>
-<pre>Path system_complete(const path&amp; p);</pre>
+<pre>path system_complete(const path&amp; p);</pre>
 <blockquote>
   <p><i>Effects:</i> Composes a complete path from <code>p</code>, using the
   same rules used by the operating system to resolve a path passed as the
@@ -3118,11 +3183,11 @@
   </tr>
 </table>
 <hr>
-<p>© Copyright Beman Dawes, 2002, 2006, 2007</p>
+<p>© Copyright Beman Dawes, 2002, 2006, 2007, 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 -->23 August 2009<!--webbot bot="Timestamp" endspan i-checksum="31532" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->02 September 2009<!--webbot bot="Timestamp" endspan i-checksum="39498" --></p>
 
 </body>
 

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-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -54,10 +54,7 @@
 using boost::throw_exception;
 using boost::throws;
 using std::string;
-
-# ifndef BOOST_FILESYSTEM_NARROW_ONLY
- using std::wstring;
-# endif
+using std::wstring;
 
 # if defined(BOOST_WINDOWS_API)
 
@@ -137,7 +134,7 @@
 # define BOOST_DELETE_FILE(P) (::unlink( P ) == 0)
 # define BOOST_COPY_DIRECTORY(F,T) (!(::stat( from.c_str(), &from_stat ) != 0\
          || ::mkdir( to.c_str(),from_stat.st_mode ) != 0))
-# define BOOST_COPY_FILE(F,T) copy_file_api(F, T)
+# 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_ERROR_NOT_SUPPORTED ENOSYS
@@ -153,7 +150,7 @@
 # define BOOST_REMOVE_DIRECTORY(P) (::RemoveDirectoryW(P) != 0)
 # define BOOST_DELETE_FILE(P) (::DeleteFileW(P) != 0)
 # define BOOST_COPY_DIRECTORY(F,T) (::CreateDirectoryExW( F, T, 0 ) != 0)
-# define BOOST_COPY_FILE(F,T) (::CopyFileW( F, T, /*fail_if_exists=*/true ) != 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_READ_SYMLINK(P,T)
 
@@ -424,23 +421,32 @@
 
 # else
 
- bool // true if ok occurred
+ bool // true if ok
   copy_file_api( const std::string & from_p,
- const std::string & to_p )
+ const std::string & to_p, bool fail_if_exists )
   {
     const std::size_t buf_sz = 32768;
     boost::scoped_array<char> buf( new char [buf_sz] );
- int infile=0, outfile=0; // init quiets compiler warning
+ int infile=-1, outfile=-1; // -1 means not open
+
+ // bug fixed: code previously did a stat() on the from_file first, but that
+ // introduced a gratuitous race condition; the stat() is now done after the open()
+
+ if ( (infile = ::open( from_p.c_str(), O_RDONLY )) < 0 )
+ { return false; }
+
     struct stat from_stat;
+ if ( ::stat( from_p.c_str(), &from_stat ) != 0 )
+ { return false; }
 
- if ( ::stat( from_p.c_str(), &from_stat ) != 0
- || (infile = ::open( from_p.c_str(),
- O_RDONLY )) < 0
- || (outfile = ::open( to_p.c_str(),
- O_WRONLY | O_CREAT | O_EXCL,
- from_stat.st_mode )) < 0 )
- { // error
- if ( infile >= 0 ) ::close( infile );
+ int oflag = O_CREAT | O_WRONLY;
+ if ( fail_if_exists ) oflag |= O_EXCL;
+ if ( (outfile = ::open( to_p.c_str(), oflag, from_stat.st_mode )) < 0 )
+ {
+ int open_errno = errno;
+ BOOST_ASSERT( infile >= 0 );
+ ::close( infile );
+ errno = open_errno;
       return false;
     }
 
@@ -466,7 +472,7 @@
     if ( ::close( infile) < 0 ) sz_read = -1;
     if ( ::close( outfile) < 0 ) sz_read = -1;
 
- return sz_read >= 0; // true if ok
+ return sz_read >= 0;
   }
 
 #endif
@@ -529,18 +535,17 @@
   BOOST_FILESYSTEM_DECL
   path complete( const path & p, const path & base )
   {
- BOOST_ASSERT( base.is_complete()
- && (p.is_complete() || !p.has_root_name())
- && "boost::filesystem::complete() precondition not met" );
-# ifdef BOOST_WINDOWS_PATH
- if (p.empty() || p.is_complete())
+ if ( p.empty() || base.empty() )
       return p;
- return !p.has_root_name() && p.has_root_directory()
+ if ( p.has_root_name() )
+ {
+ return p.has_root_directory()
+ ? p
+ : p.root_name() / base.root_directory() / base.relative_path() / p.relative_path();
+ }
+ return p.has_root_directory()
       ? base.root_name() / p
       : base / p;
-# else
- return (p.empty() || p.is_complete()) ? p : base / p;
-# endif
   }
 
   BOOST_FILESYSTEM_DECL
@@ -559,7 +564,7 @@
     }
     else if( is_regular_file( s ) )
     {
- copy_file( from, to, ec );
+ copy_file( from, to, copy_option::fail_if_exists, ec );
     }
     else
     {
@@ -581,10 +586,13 @@
   }
 
   BOOST_FILESYSTEM_DECL
- void copy_file( const path & from, const path & to, error_code & ec )
- {
- error( !BOOST_COPY_FILE( from.c_str(), to.c_str() ),
- from, to, ec, "boost::filesystem::copy_file" );
+ void copy_file( const path & from, const path & to,
+ BOOST_SCOPED_ENUM(copy_option) option,
+ error_code & ec )
+ {
+ error( !BOOST_COPY_FILE( from.c_str(), to.c_str(),
+ option == copy_option::fail_if_exists ),
+ from, to, ec, "boost::filesystem::copy_file" );
   }
 
   BOOST_FILESYSTEM_DECL

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 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -55,9 +55,9 @@
   // miscellaneous class path helpers //
   //------------------------------------------------------------------------------------//
 
- typedef path::size_type size_type;
- typedef path::string_type string_type;
- typedef path::value_type value_type;
+ typedef path::value_type value_type;
+ typedef path::string_type string_type;
+ typedef string_type::size_type size_type;
 
   const std::size_t default_codecvt_buf_size = BOOST_FILESYSTEM_CODECVT_BUF_SIZE;
 
@@ -128,6 +128,16 @@
 namespace filesystem
 {
 
+ path & path::operator/=( const path & p )
+ {
+ if ( p.empty() )
+ return *this;
+ if ( !is_separator( *p.m_path.begin() ) )
+ m_append_separator_if_needed();
+ m_path += p.m_path;
+ return *this;
+ }
+
 # ifdef BOOST_WINDOWS_PATH
 
   const std::string path::native_string() const
@@ -176,9 +186,9 @@
 
 # endif // BOOST_WINDOWS_PATH
 
- // m_append_separator_if_needed -----------------------------------------//
+ // m_append_separator_if_needed ----------------------------------------------------//
 
- void path::m_append_separator_if_needed()
+ path::string_type::size_type path::m_append_separator_if_needed()
   {
     if ( !m_path.empty() &&
 # ifdef BOOST_WINDOWS_PATH
@@ -186,11 +196,27 @@
 # endif
       !is_separator( *(m_path.end()-1) ) )
     {
+ string_type::size_type tmp( m_path.size() );
       m_path += 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_path.size() // and something was appended
+ && (m_path[sep_pos+1] == separator // and it was also separator
+# ifdef BOOST_WINDOWS_PATH
+ || m_path[sep_pos+1] == preferred_separator // or preferred_separator
+# endif
+ )) { m_path.erase( sep_pos, 1 ); } // erase the added separator
   }
 
- // decomposition ---------------------------------------------------------//
+ // decomposition -------------------------------------------------------------------//
 
   path path::root_path() const
   {
@@ -560,7 +586,7 @@
   {
     iterator itr;
     itr.m_path_ptr = this;
- path::size_type element_size;
+ size_type element_size;
     first_element( m_path, itr.m_pos, element_size );
     itr.m_element = m_path.substr( itr.m_pos, element_size );
     if ( itr.m_element.m_path == preferred_separator_string )

Modified: sandbox/filesystem-v3/libs/filesystem/src/portability.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/portability.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/portability.cpp 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -56,7 +56,9 @@
 # else
     BOOST_FILESYSTEM_DECL bool native( const std::string & name )
     {
- return name.find('/') == std::string::npos;
+ return name.size() != 0
+ && name[0] != ' '
+ && name.find('/') == std::string::npos;
     }
 # endif
 

Modified: sandbox/filesystem-v3/libs/filesystem/test/convenience_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/convenience_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/convenience_test.cpp 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -23,12 +23,6 @@
 #include <fstream>
 #include <iostream>
 
-#ifndef BOOST_FILESYSTEM_NARROW_ONLY
-# define BOOST_FS_IS_EMPTY fs::is_empty
-#else
-# define BOOST_FS_IS_EMPTY fs::_is_empty
-#endif
-
 namespace
 {
   template< typename F >

Modified: sandbox/filesystem-v3/libs/filesystem/test/deprecated_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/deprecated_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/deprecated_test.cpp 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -8,9 +8,11 @@
 
 // Library home page: http://www.boost.org/libs/filesystem
 
-// This test verifies that various deprecated names still compile. This is
+// 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/detail/lightweight_test.hpp>
 
@@ -30,7 +32,7 @@
 
     ++::boost::detail::test_errors();
 
- std::cout << '(' << line << ") source.string(): \"" << source.string()
+ std::cout << '(' << line << ") source.native_string(): \"" << source.native_string()
               << "\" != expected: \"" << expected
               << "\"" << std::endl;
   }
@@ -141,7 +143,7 @@
   // }
   //}
 
- // Compile-only tests. Not intended to be executed.
+ // Compile-only tests not intended to be executed -----------------------------------//
 
   void compile_only()
   {
@@ -154,10 +156,30 @@
     p.directory_string();
   }
 
+ // rename_test ----------------------------------------------------------------------//
+
+ void 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() );
+
+ 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 main( int /*argc*/, char * /*argv*/[] )
 {
@@ -169,19 +191,21 @@
                : "POSIX";
   std::cout << "Platform is " << platform << '\n';
 
- path::default_name_check( fs::no_check );
+ //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();
+ //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" ) );
 
+ rename_test();
+
   //check_normalize();
  
 // extension() tests ---------------------------------------------------------//

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-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -27,6 +27,10 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fstream_test", "fstream_test\fstream_test.vcproj", "{A9939CD7-BE1C-4334-947C-4C320D49B3CA}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "deprecated_test", "deprecated_test\deprecated_test.vcproj", "{D73BC50F-956E-4A44-BF9F-A8BB80DF0000}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+ {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+ EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "proof_of_concept", "proof_of_concept\proof_of_concept.vcproj", "{440316C4-E19E-41DE-92A6-B78B3900E97F}"
 EndProject
@@ -36,6 +40,12 @@
                 {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
         EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complete_func_combos", "complete_func_combos\complete_func_combos.vcproj", "{B0725661-C439-484E-BD67-E367AC78C60A}"
+ 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
@@ -89,6 +99,10 @@
                 {6B8EC880-702E-418A-BC63-CA46C6CC7B27}.Debug|Win32.Build.0 = Debug|Win32
                 {6B8EC880-702E-418A-BC63-CA46C6CC7B27}.Release|Win32.ActiveCfg = Release|Win32
                 {6B8EC880-702E-418A-BC63-CA46C6CC7B27}.Release|Win32.Build.0 = Release|Win32
+ {B0725661-C439-484E-BD67-E367AC78C60A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B0725661-C439-484E-BD67-E367AC78C60A}.Debug|Win32.Build.0 = Debug|Win32
+ {B0725661-C439-484E-BD67-E367AC78C60A}.Release|Win32.ActiveCfg = Release|Win32
+ {B0725661-C439-484E-BD67-E367AC78C60A}.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-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -952,12 +952,33 @@
 
   // copy_file() tests
   std::cout << "begin copy_file test..." << std::endl;
+ BOOST_TEST( fs::exists( file_ph ) );
+ fs::remove( d1 / "f2" ); // remove possible residue from prior testing
+ BOOST_TEST( fs::exists( d1 ) );
+ BOOST_TEST( !fs::exists( d1 / "f2" ) );
+ std::cout << " copy " << file_ph << " to " << d1 / "f2" << std::endl;
   fs::copy_file( file_ph, d1 / "f2" );
- std::cout << "copying complete" << std::endl;
+ std::cout << " copy complete" << std::endl;
   BOOST_TEST( fs::exists( file_ph ) );
   BOOST_TEST( fs::exists( d1 / "f2" ) );
   BOOST_TEST( !fs::is_directory( d1 / "f2" ) );
   verify_file( d1 / "f2", "foobar1" );
+
+ bool copy_ex_ok = false;
+ try { fs::copy_file( file_ph, d1 / "f2" ); }
+ catch ( const fs::filesystem_error & ) { copy_ex_ok = true; }
+ BOOST_TEST( copy_ex_ok );
+
+ copy_ex_ok = false;
+ try { fs::copy_file( file_ph, d1 / "f2", fs::copy_option::fail_if_exists ); }
+ catch ( const fs::filesystem_error & ) { copy_ex_ok = true; }
+ BOOST_TEST( copy_ex_ok );
+
+ copy_ex_ok = true;
+ try { fs::copy_file( file_ph, d1 / "f2", fs::copy_option::overwrite_if_exists ); }
+ catch ( const fs::filesystem_error & ) { copy_ex_ok = false; }
+ BOOST_TEST( copy_ex_ok );
+
   std::cout << "copy_file test complete" << std::endl;
 
   rename_tests();

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 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -27,8 +27,6 @@
 
 namespace fs = boost::filesystem;
 using boost::filesystem::path;
-using boost::next;
-using boost::prior;
 
 #include <boost/detail/lightweight_test.hpp>
 
@@ -43,14 +41,15 @@
   void check( const fs::path & source,
               const std::string & expected, const char* file, int line )
   {
- if ( source.native_string()== expected ) return;
+ if ( source.native_string() == expected )
+ return;
 
     std::cout << file
- << '(' << line << "): source.native_string(): \"" << source.native_string()
+ << '(' << line << "): source: \"" << source
               << "\" != expected: \"" << expected
               << "\"" << std::endl;
 
- BOOST_ERROR(0); // increment error count
+ ++::boost::detail::test_errors();
   }
 
   void check_equal( const fs::path & source,
@@ -60,7 +59,7 @@
 
     ++::boost::detail::test_errors();
 
- std::cout << file << '(' << line << "): source: \"" << source.string()
+ std::cout << file << '(' << line << "): source: \"" << source
               << "\" != expected: \"" << expected
               << "\"" << std::endl;
   }
@@ -142,18 +141,18 @@
 
     itr_ck = "foo";
     BOOST_TEST( *itr_ck.begin() == std::string( "foo" ) );
- BOOST_TEST( next( itr_ck.begin() ) == itr_ck.end() );
- BOOST_TEST( *prior( itr_ck.end() ) == std::string( "foo" ) );
- BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() );
+ BOOST_TEST( boost::next( itr_ck.begin() ) == itr_ck.end() );
+ BOOST_TEST( *boost::prior( itr_ck.end() ) == std::string( "foo" ) );
+ BOOST_TEST( boost::prior( itr_ck.end() ) == itr_ck.begin() );
 
     itr_ck = path( "/foo" );
     BOOST_TEST( *itr_ck.begin() == std::string( "/" ) );
- BOOST_TEST( *next( itr_ck.begin() ) == std::string( "foo" ) );
- BOOST_TEST( next(next( itr_ck.begin() )) == itr_ck.end() );
- BOOST_TEST( next( itr_ck.begin() ) == prior( itr_ck.end() ) );
- BOOST_TEST( *prior( itr_ck.end() ) == std::string( "foo" ) );
- BOOST_TEST( *prior(prior( itr_ck.end() )) == std::string( "/" ) );
- BOOST_TEST( prior(prior( itr_ck.end() )) == itr_ck.begin() );
+ BOOST_TEST( *boost::next( itr_ck.begin() ) == std::string( "foo" ) );
+ BOOST_TEST( boost::next(boost::next( itr_ck.begin() )) == itr_ck.end() );
+ BOOST_TEST( boost::next( itr_ck.begin() ) == boost::prior( itr_ck.end() ) );
+ BOOST_TEST( *boost::prior( itr_ck.end() ) == std::string( "foo" ) );
+ BOOST_TEST( *boost::prior(boost::prior( itr_ck.end() )) == std::string( "/" ) );
+ BOOST_TEST( boost::prior(boost::prior( itr_ck.end() )) == itr_ck.begin() );
 
     itr_ck = "/foo/bar";
     itr = itr_ck.begin();
@@ -406,7 +405,7 @@
       BOOST_TEST( (b / as).native_string() == "b\\a" );
       BOOST_TEST( (b / acs).native_string() == "b\\a" );
       PATH_CHECK( path("a") / "b", "a\\b" );
- PATH_CHECK( path("..") / "", "..\\" );
+ PATH_CHECK( path("..") / "", ".." );
       PATH_CHECK( path("foo") / path("bar"), "foo\\bar" ); // path arg
       PATH_CHECK( path("foo") / "bar", "foo\\bar" ); // const char * arg
       PATH_CHECK( path("foo") / path("woo/bar").filename(), "foo\\bar" ); // const std::string & arg
@@ -531,17 +530,6 @@
     BOOST_TEST( path("a/b") < path("a.b") );
 
     // make sure the derivative operators also work
- BOOST_TEST( a == a2 );
- BOOST_TEST( as == a2 );
- BOOST_TEST( acs == a2 );
- BOOST_TEST( a == as2 );
- BOOST_TEST( a == acs2 );
-
- BOOST_TEST( a != b );
- BOOST_TEST( as != b );
- BOOST_TEST( acs != b );
- BOOST_TEST( a != bs );
- BOOST_TEST( a != bcs );
 
     BOOST_TEST( b > a );
     BOOST_TEST( b > as );
@@ -578,6 +566,30 @@
     BOOST_TEST( acs2 >= a );
     BOOST_TEST( a2 >= as );
     BOOST_TEST( a2 >= acs );
+
+ // operator == and != are implemented separately, so test separately
+
+ path p1( "fe/fi/fo/fum" );
+ path p2( p1 );
+ path p3( "fe/fi/fo/fumm" );
+ BOOST_TEST( p1.string() != p3.string() );
+
+ // check each overload
+ BOOST_TEST( p1 != p3 );
+ BOOST_TEST( p1 != p3.string() );
+ BOOST_TEST( p1 != p3.string().c_str() );
+ BOOST_TEST( p1.string() != p3 );
+ BOOST_TEST( p1.string().c_str() != p3 );
+
+ p3 = p2;
+ BOOST_TEST( p1.string() == p3.string() );
+
+ // check each overload
+ BOOST_TEST( p1 == p3 );
+ BOOST_TEST( p1 == p3.string() );
+ BOOST_TEST( p1 == p3.string().c_str() );
+ BOOST_TEST( p1.string() == p3 );
+ BOOST_TEST( p1.string().c_str() == p3 );
   }
 
   // query_and_decomposition_tests -----------------------------------------//
@@ -1168,25 +1180,103 @@
 
   // append_tests --------------------------------------------------------------------//
 
+ void append_test_aux( const path & p, const std::string & s, const std::string & expect )
+ {
+ PATH_CHECK( p / path(s), expect );
+ PATH_CHECK( p / s.c_str(), expect );
+ PATH_CHECK( p / s, expect );
+ path x(p);
+ x.append( s.begin(), s.end() );
+ PATH_CHECK( x, expect );
+ }
+
   void append_tests()
   {
     std::cout << "append_tests..." << std::endl;
 
+ // There are many control paths to be exercised, since empty paths and arguments,
+ // paths with trailing separators, arguments with leading separators, with or without
+ // other characters being present, are all separate cases that need to be tested.
+ // Furthermore, some of the code to be tested is specific to argument categories,
+ // so that results in further permutations to be tested.
+
+ //// code to generate test cases
+ ////
+ //// expected results must be checked by hand
+ //// "foo\bar" expected result must be edited by hand and moved for Windows/POSIX
+ ////
+ //const char * x[] = { "", "/", "foo", "foo/" };
+ //const char * y[] = { "", "/", "bar", "/bar" };
+
+ //for ( int i = 0; i < sizeof(x)/sizeof(char*); ++i )
+ // for ( int j = 0; j < sizeof(y)/sizeof(char*); ++j )
+ // {
+ // std::cout << "\n PATH_CHECK( path(\"" << x[i] << "\") / \"" << y[j] << "\", \""
+ // << path(x[i]) / y[j] << "\" );\n";
+ // std::cout << " append_test_aux( \"" << x[i] << "\", \"" << y[j] << "\", \""
+ // << path(x[i]) / y[j] << "\");\n";
+ // }
+
+ PATH_CHECK( path("") / "", "" );
+ append_test_aux( "", "", "");
+
+ PATH_CHECK( path("") / "/", "/" );
+ append_test_aux( "", "/", "/");
+
+ PATH_CHECK( path("") / "bar", "bar" );
+ append_test_aux( "", "bar", "bar");
+
+ PATH_CHECK( path("") / "/bar", "/bar" );
+ append_test_aux( "", "/bar", "/bar");
+
+ PATH_CHECK( path("/") / "", "/" );
+ append_test_aux( "/", "", "/");
+
+ PATH_CHECK( path("/") / "/", "//" );
+ append_test_aux( "/", "/", "//");
+
+ PATH_CHECK( path("/") / "bar", "/bar" );
+ append_test_aux( "/", "bar", "/bar");
+
+ PATH_CHECK( path("/") / "/bar", "//bar" );
+ append_test_aux( "/", "/bar", "//bar");
+
+ PATH_CHECK( path("foo") / "", "foo" );
+ append_test_aux( "foo", "", "foo");
+
+ PATH_CHECK( path("foo") / "/", "foo/" );
+ append_test_aux( "foo", "/", "foo/");
+
+ PATH_CHECK( path("foo") / "/bar", "foo/bar" );
+ append_test_aux( "foo", "/bar", "foo/bar");
+
+ PATH_CHECK( path("foo/") / "", "foo/" );
+ append_test_aux( "foo/", "", "foo/");
+
+ PATH_CHECK( path("foo/") / "/", "foo//" );
+ append_test_aux( "foo/", "/", "foo//");
+
+ PATH_CHECK( path("foo/") / "bar", "foo/bar" );
+ append_test_aux( "foo/", "bar", "foo/bar");
+
+ PATH_CHECK( path("foo/") / "/bar", "foo//bar" );
+ append_test_aux( "foo/", "/bar", "foo//bar");
+
     if ( platform == "Windows" )
     {
+ PATH_CHECK( path("foo") / "bar", "foo\\bar" );
+ append_test_aux( "foo", "bar", "foo\\bar");
+
+ // hand created test case specific to Windows
+ PATH_CHECK( path("c:") / "bar", "c:bar" );
+ append_test_aux( "c:", "bar", "c:bar" );
     }
     else
     {
+ PATH_CHECK( path("foo") / "bar", "foo/bar" );
+ append_test_aux( "foo", "bar", "foo/bar");
     }
 
-
- PATH_CHECK( path("") / "foo", "foo" );
- PATH_CHECK( path("") / "foo/", "foo/" );
- PATH_CHECK( path( "/" ) / "", "/" );
- PATH_CHECK( path("") / "/foo", "/foo" );
- PATH_CHECK( path("foo") / "", "foo\\" );
- PATH_CHECK( path("/foo") / "", "/foo\\" );
-
   }
 
   // name_function_tests -------------------------------------------------------------//
@@ -1379,8 +1469,6 @@
 
   std::string s1( "//:somestring" ); // this used to be treated specially
 
-# ifndef BOOST_NO_MEMBER_TEMPLATES
-
   // check the path member templates
   p5.assign( s1.begin(), s1.end() );
 
@@ -1388,25 +1476,6 @@
   p5 = s1;
   PATH_CHECK( p5, "//:somestring" );
 
- char c0 = 'a';
- p5.assign( &c0, &c0 );
- PATH_CHECK( p5, "" );
- p5 /= "";
- PATH_CHECK( p5, "" );
- p5 /= "foo/bar";
- PATH_CHECK( p5, "foo/bar" );
- p5 /= "";
- PATH_CHECK( p5, "foo/bar\\" );
- p5.append( &c0, &c0 );
- PATH_CHECK( p5, "foo/bar\\" );
- p5 /= "";
- PATH_CHECK( p5, "foo/bar\\" );
- char bf[]= "bar/foo";
- p5.assign( bf, bf + sizeof(bf) - 1 );
- PATH_CHECK( p5, bf );
- p5.append( bf, bf + sizeof(bf) - 1 );
- PATH_CHECK( p5, "bar/foo\\bar/foo" );
-
   // this code, courtesy of David Whetstone, detects a now fixed bug that
   // derefereced the end iterator (assuming debug build with checked itors)
   std::vector<char> v1;
@@ -1416,8 +1485,6 @@
   p5.assign( s1.begin(), s1.begin() + 1 );
   PATH_CHECK( p5, "/" );
 
-# endif
-
   BOOST_TEST( p1 != p4 );
   BOOST_TEST( p1.string() == p2.string() );
   BOOST_TEST( p1.string() == p3.string() );

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 2009-09-02 14:29:37 EDT (Wed, 02 Sep 2009)
@@ -54,7 +54,8 @@
     ++::boost::detail::test_errors();
 
     std::cout << file;
- std::wcout << L'(' << line << L"): source.wstring(): \"" << source.wstring()
+ std::wcout << L'(' << line << L"): source.native_wstring(): \""
+ << source.native_wstring()
                << L"\" != expected: \"" << expected
                << L"\"\n" ;
   }
@@ -189,19 +190,19 @@
 
     x = "/foo";
     x /= path(""); // empty path
- PATH_IS(x, BOOST_FS_FOO);
+ PATH_IS(x, L"/foo");
 
     x = "/foo";
     x /= path("/"); // slash path
- PATH_IS(x, BOOST_FS_FOO L"/");
+ PATH_IS(x, L"/foo/");
 
     x = "/foo";
     x /= path("/boo"); // slash path
- PATH_IS(x, BOOST_FS_FOO L"/boo");
+ PATH_IS(x, L"/foo/boo");
 
     x = "/foo";
- x /= x; // self-assignment
- PATH_IS(x, BOOST_FS_FOO BOOST_FS_FOO );
+ x /= x; // self-append
+ PATH_IS(x, L"/foo/foo");
 
     x = "/foo";
     x /= path("yet another path"); // another path
@@ -275,14 +276,14 @@
 
     CHECK( string( p.c_str() ) == "abc\\def/ghi" );
 
+ CHECK( p.native_string() == "abc\\def/ghi" );
+ CHECK( p.native_wstring() == L"abc\\def/ghi" );
+
     CHECK( p.string() == "abc\\def/ghi" );
     CHECK( p.wstring() == L"abc\\def/ghi" );
 
- CHECK( p.generic().string() == "abc\\def/ghi" );
- CHECK( p.generic().wstring() == L"abc\\def/ghi" );
-
- CHECK( p.preferred().string() == "abc\\def/ghi" );
- CHECK( p.preferred().wstring() == L"abc\\def/ghi" );
+ //CHECK( p.preferred().string() == "abc\\def/ghi" );
+ //CHECK( p.preferred().wstring() == L"abc\\def/ghi" );
 
 # 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