|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50728 - in sandbox/filesystem-v3: boost/filesystem libs/filesystem/doc libs/filesystem/src libs/filesystem/test libs/filesystem/test/msvc/filesystem_dll libs/filesystem/test/msvc/path_test
From: bdawes_at_[hidden]
Date: 2009-01-22 09:54:59
Author: bemandawes
Date: 2009-01-22 09:54:58 EST (Thu, 22 Jan 2009)
New Revision: 50728
URL: http://svn.boost.org/trac/boost/changeset/50728
Log:
Filesystem.v3: Change from throws object to throws() function as error_code tag. Fix several error handling bugs detected in testing this change.
Text files modified:
sandbox/filesystem-v3/boost/filesystem/operations.hpp | 64 ++++++++++++++++----------------
sandbox/filesystem-v3/boost/filesystem/path.hpp | 56 ++++++++++++++--------------
sandbox/filesystem-v3/libs/filesystem/doc/v3_design.html | 20 ++++++++-
sandbox/filesystem-v3/libs/filesystem/src/operations.cpp | 79 +++++++++++++++++++++------------------
sandbox/filesystem-v3/libs/filesystem/src/path.cpp | 11 +++--
sandbox/filesystem-v3/libs/filesystem/test/convenience_test.cpp | 1
sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj | 8 ++++
sandbox/filesystem-v3/libs/filesystem/test/msvc/path_test/path_test.vcproj | 4 ++
8 files changed, 138 insertions(+), 105 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-01-22 09:54:58 EST (Thu, 22 Jan 2009)
@@ -24,7 +24,7 @@
* Review any commented out code, both in operations.hpp and operations.cpp
* Finish refactoring operations_test.
* Fold convenience.hpp into operations.hpp
-* Two argument recursive_directory_iterator ctor isn't recognizing system::throws.
+* Two argument recursive_directory_iterator ctor isn't recognizing throws().
would it be better to fold into a single two argument ctor with default?
* Add the push_directory class from tools/release/required_files.cpp
@@ -137,20 +137,20 @@
BOOST_FILESYSTEM_DECL
file_status status( const path & p,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
file_status symlink_status( const path & p,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
- inline bool exists( const path & p, system::error_code & ec = system::throws ) { return exists( status( p, ec ) ); }
- inline bool is_directory( const path & p, system::error_code & ec = system::throws ) { return is_directory( status( p, ec ) ); }
- inline bool is_regular_file( const path & p, system::error_code & ec = system::throws ) { return is_regular_file( status( p, ec ) ); }
- inline bool is_other( const path & p, system::error_code & ec = system::throws ) { return is_other( status( p, ec ) ); }
- inline bool is_symlink( const path & p, system::error_code & ec = system::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 = system::throws ) { return is_regular( status( p, ec ) ); }
+ inline bool is_regular( const path & p, system::error_code & ec = throws() ) { return is_regular( status( p, ec ) ); }
# endif
@@ -173,7 +173,7 @@
// }
BOOST_FILESYSTEM_DECL
- bool is_empty( const path & p, system::error_code & ec = system::throws );
+ bool is_empty( const path & p, system::error_code & ec = throws() );
//--------------------------------------------------------------------------------------//
// //
@@ -183,74 +183,74 @@
//--------------------------------------------------------------------------------------//
BOOST_FILESYSTEM_DECL // declaration must precede complete()
- path initial_path( system::error_code & ec = system::throws );
+ path initial_path( system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
path complete( const path & p, const path & base = initial_path() );
BOOST_FILESYSTEM_DECL
void copy_file( const path & from, const path & to,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
bool create_directories( const path & p/*,
- system::error_code & ec = system::throws*/ );
+ system::error_code & ec = throws()*/ );
BOOST_FILESYSTEM_DECL
- bool create_directory( const path & p, system::error_code & ec = system::throws );
+ bool create_directory( const path & p, system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
void create_directory_symlink( const path & to, const path & from,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
void create_hard_link( const path & to, const path & from,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
void create_symlink( const path & to, const path & from,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
- path current_path( system::error_code & ec = system::throws );
+ path current_path( system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
- void current_path( const path & p, system::error_code & ec = system::throws );
+ void current_path( const path & p, system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
bool equivalent( const path & p1, const path & p2,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
boost::uintmax_t file_size( const path & p,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
// initial_path() declaration precedes complete()
BOOST_FILESYSTEM_DECL
std::time_t last_write_time( const path & p,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
void last_write_time( const path & p, const std::time_t new_time,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
- bool remove( const path & p, system::error_code & ec = system::throws );
+ bool remove( const path & p, system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
boost::uintmax_t remove_all( const path & p,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
void rename( const path & from, const path & to,
- system::error_code & ec = system::throws );
+ system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
- space_info space( const path & p, system::error_code & ec = system::throws );
+ space_info space( const path & p, system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
- path system_complete( const path & p, system::error_code & ec = system::throws );
+ path system_complete( const path & p, system::error_code & ec = throws() );
//--------------------------------------------------------------------------------------//
// //
@@ -294,8 +294,8 @@
# endif
const boost::filesystem::path & path() const { return m_path; }
- file_status status( system::error_code & ec = system::throws ) const;
- file_status symlink_status( system::error_code & ec = system::throws ) const;
+ file_status status( system::error_code & ec = throws() ) const;
+ file_status symlink_status( system::error_code & ec = throws() ) const;
// conversion simplifies the most common use of directory_entry
operator const boost::filesystem::path &() const { return m_path; }
@@ -334,7 +334,7 @@
namespace detail
{
BOOST_FILESYSTEM_DECL
- system::error_code dir_itr_close( // never throws
+ system::error_code dir_itr_close( // never throws()
void *& handle
# if defined(BOOST_POSIX_API)
, void *& buffer
@@ -392,7 +392,7 @@
// iterator_facade derived classes don't seem to like implementations in
// separate translation unit dll's, so forward to detail functions
directory_iterator( const path & p,
- system::error_code & ec = system::throws )
+ system::error_code & ec = throws() )
: m_imp( new detail::dir_itr_imp )
{ detail::directory_iterator_construct( *this, p, ec ); }
Modified: sandbox/filesystem-v3/boost/filesystem/path.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path.hpp 2009-01-22 09:54:58 EST (Thu, 22 Jan 2009)
@@ -44,7 +44,7 @@
notational convenience.
* Are generic versions of string(), native_string() needed? IE:
template< class T >
- T string( const error_code ec = throws );
+ T string( const error_code ec = throws() );
TODO: Yes; all member functions need to be usable in generic code.
Can string() and native_string() make use of detail::convert()?
* Assuming generic versions of string(), native_string(), are the w flavors needed?
@@ -219,22 +219,22 @@
inline void append<string_type::value_type>( const string_type::value_type * begin,
const string_type::value_type * end, string_type & target, system::error_code & ec )
{
- ec.clear();
- target.assign( begin, end ); // TODO: what if throws bad_alloc?
+ target.assign( begin, end ); // TODO: what if throws() bad_alloc?
+ if ( &ec != &throws() ) ec.clear();
}
template<>
inline void append<string_type::value_type>( const string_type::value_type * begin,
string_type & target, system::error_code & ec )
{
- ec.clear();
- target += begin; // TODO: what if throws bad_alloc?
+ target += begin; // TODO: what if throws() bad_alloc?
+ if ( &ec != &throws() ) ec.clear();
}
template<>
inline string_type convert<string_type>( const string_type & s, system::error_code & ec )
{
- if ( &ec != &system::throws ) ec.clear();
+ if ( &ec != &throws() ) ec.clear();
return s;
}
@@ -318,7 +318,7 @@
// template< class ForwardIterator, class WStringConvert >
// path( ForwardIterator begin, ForwardIterator end,
// const std::locale & loc,
- // system::error_code & ec = system::throws );
+ // system::error_code & ec = boost::throws() );
//
// This alternative was rejected as too complex for the limited benefits;
// it nearly doubles the size of the interface, and adds a lot of
@@ -353,7 +353,7 @@
template< class InputIterator >
path( InputIterator begin,
- system::error_code & ec = system::throws,
+ system::error_code & ec = boost::throws(),
typename boost::enable_if<path_traits::is_iterator<InputIterator> >::type* dummy=0 ) // #3
{ m_append( begin, m_path, ec ); }
@@ -363,7 +363,7 @@
template< class ForwardIterator >
path( ForwardIterator begin, ForwardIterator end,
- system::error_code & ec = system::throws ) // #4
+ system::error_code & ec = boost::throws() ) // #4
{ m_append( begin, end, m_path, ec ); }
// construct from container of (potentially) multi-byte character string,
@@ -372,7 +372,7 @@
template< class Container >
path( const Container & ctr,
- system::error_code & ec = system::throws,
+ system::error_code & ec = boost::throws(),
typename boost::enable_if<path_traits::is_container<Container> >::type* dummy=0 ) // #5
{ m_append( ctr.begin(), ctr.end(), m_path, ec ); }
@@ -390,14 +390,14 @@
operator=( InputIterator begin ) // #2
{
m_path.clear();
- m_append( begin, m_path, system::throws );
+ m_append( begin, m_path, boost::throws() );
return *this;
}
template< class InputIterator >
typename boost::enable_if<path_traits::is_iterator<InputIterator>, path &>::type
assign( InputIterator begin,
- system::error_code & ec = system::throws ) // #3
+ system::error_code & ec = boost::throws() ) // #3
{
m_path.clear();
m_append( begin, m_path, ec );
@@ -406,7 +406,7 @@
template< class FowardIterator >
path & assign( FowardIterator begin, FowardIterator end,
- system::error_code & ec = system::throws ) // #4
+ system::error_code & ec = boost::throws() ) // #4
{
m_path.clear();
m_append( begin, end, m_path, ec );
@@ -418,14 +418,14 @@
operator=( const Container & ctr ) // #5
{
m_path.clear();
- m_append( ctr.begin(), ctr.end(), m_path, system::throws );
+ m_append( ctr.begin(), ctr.end(), m_path, boost::throws() );
return *this;
}
template< class Container >
typename boost::enable_if<path_traits::is_container<Container>, path &>::type
assign( const Container & ctr,
- system::error_code & ec = system::throws ) // #6
+ system::error_code & ec = boost::throws() ) // #6
{
m_path.clear();
m_append( ctr.begin(), ctr.end(), m_path, ec );
@@ -446,14 +446,14 @@
operator/=( InputIterator begin ) // #2
{
append_separator_if_needed_();
- m_append( begin, m_path, system::throws );
+ m_append( begin, m_path, boost::throws() );
return *this;
}
template< class InputIterator >
typename boost::enable_if<path_traits::is_iterator<InputIterator>, path &>::type
append( InputIterator begin,
- system::error_code & ec = system::throws ) // #3
+ system::error_code & ec = boost::throws() ) // #3
{
append_separator_if_needed_();
m_append( begin, m_path, ec );
@@ -462,7 +462,7 @@
template< class FowardIterator >
path & append( FowardIterator begin, FowardIterator end,
- system::error_code & ec = system::throws ) // #4
+ system::error_code & ec = boost::throws() ) // #4
{
append_separator_if_needed_();
m_append( begin, end, m_path, ec );
@@ -474,14 +474,14 @@
operator/=( const Container & ctr ) // #5
{
append_separator_if_needed_();
- m_append( ctr.begin(), ctr.end(), m_path, system::throws );
+ m_append( ctr.begin(), ctr.end(), m_path, boost::throws() );
return *this;
}
template< class Container >
typename boost::enable_if<path_traits::is_container<Container>, path &>::type
append( const Container & ctr,
- system::error_code & ec = system::throws ) // #6
+ system::error_code & ec = boost::throws() ) // #6
{
append_separator_if_needed_();
m_append( ctr.begin(), ctr.end(), m_path, ec );
@@ -509,12 +509,12 @@
operator const string_type&() const { return m_path; }
operator const detail::interface_string_type() const
{
- return detail::convert_to_string( m_path, system::throws );
+ return detail::convert_to_string( m_path, boost::throws() );
}
# ifdef BOOST_FILESYSTEM_CPP0X_CHAR_TYPES
- operator const std::u16string() const { return detail::convert_to_u16string( m_path, system::throws ); }
- operator const std::u32string() const { return detail::convert_to_u32string( m_path, system::throws ); }
+ operator const std::u16string() const { return detail::convert_to_u16string( m_path, boost::throws() ); }
+ operator const std::u32string() const { return detail::convert_to_u32string( m_path, boost::throws() ); }
# endif
// ----- observers -----
@@ -527,7 +527,7 @@
// Implementations are permitted to return const values or const references.
template< class T >
- T string( system::error_code & ec = system::throws ) const
+ T string( system::error_code & ec = boost::throws() ) const
{
return path_traits::convert<T>( m_path, ec );
}
@@ -535,7 +535,7 @@
# ifdef BOOST_WINDOWS_API
// return value is formatted "as input"
- const std::string string( system::error_code & ec = system::throws ) const { return detail::convert_to_string( m_path, ec ); }
+ const std::string string( system::error_code & ec = boost::throws() ) const { return detail::convert_to_string( m_path, ec ); }
const std::wstring & wstring() const { return m_path; }
const std::wstring & wstring( system::error_code & ec ) const { ec.clear(); return m_path; }
@@ -545,7 +545,7 @@
const std::string & string() const { return m_path; }
const std::string & string( system::error_code & ec ) const { ec.clear(); return m_path; }
# ifndef BOOST_FILESYSTEM_NARROW_ONLY
- const std::wstring wstring( system::error_code & ec = system::throws ) const { return detail::convert_to_string( m_path, ec ); }
+ const std::wstring wstring( system::error_code & ec = boost::throws() ) const { return detail::convert_to_string( m_path, ec ); }
# endif
# endif
@@ -705,13 +705,13 @@
{
public:
scoped_path_locale( const std::locale & loc,
- system::error_code & ec = system::throws )
+ system::error_code & ec = boost::throws() )
: m_saved_locale(loc)
{
path::imbue( loc, ec );
}
- ~scoped_path_locale() // never throws
+ ~scoped_path_locale() // never throws()
{
system::error_code ec;
path::imbue( m_saved_locale, ec );
Modified: sandbox/filesystem-v3/libs/filesystem/doc/v3_design.html
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/v3_design.html (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/v3_design.html 2009-01-22 09:54:58 EST (Thu, 22 Jan 2009)
@@ -41,6 +41,7 @@
<a href="#Problem">Problem</a><br>
<a href="#Solution">Solution</a><br>
<a href="#Details">Details</a><br>
+ Other changes<br>
<a href="#Prototype">Prototype</a></td>
</tr>
<tr>
@@ -95,8 +96,8 @@
<p>Overview:</p>
<ul>
- <li>Provide a single, non-template, <code>class path</code>.</li>
- <li>Provide each member function as a template accommodating the various
+ <li>A single, non-template, <code>class path</code>.</li>
+ <li>Each member function is a template accommodating the various
applicable character types, including user-defined character types.</li>
<li>Hold the path internally in a string of the type used by the operating
system API; <code>std::string</code> for POSIX, <code>std::wstring</code> for Windows.</li>
@@ -163,6 +164,19 @@
to a specified encoding such as one of the Unicode encodings. This avoids
unintended consequences, etc.</p>
+<h2><a name="Other-changes">Other changes</a></h2>
+
+<p><b>Uniform hybrid error handling: </b>The hybrid error handling idiom has
+been consistently applied to all applicable functions.</p>
+
+<p><b>Additional filesystem operations:</b></p>
+
+<ul>
+ <li>create_symlink() now available on Windows if supported (i.e. Vista and
+ later).</li>
+ <li>create_directory_symlink() added.</li>
+</ul>
+
<h2><a name="Prototype">Prototype</a></h2>
<p>Currently incomplete. Not thoroughly tested. Should not be used for
@@ -170,7 +184,7 @@
<hr>
<p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->17 January, 2009<!--webbot bot="Timestamp" endspan i-checksum="39347" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->21 January, 2009<!--webbot bot="Timestamp" endspan i-checksum="39336" --></p>
<p>© Copyright Beman Dawes, 2008</p>
<p> Use, modification, and distribution are subject to the Boost Software
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-01-22 09:54:58 EST (Thu, 22 Jan 2009)
@@ -56,8 +56,8 @@
using boost::system::error_code;
using boost::system::error_category;
using boost::system::system_category;
-using boost::system::throws;
using boost::throw_exception;
+using boost::throws;
using std::string;
# ifndef BOOST_FILESYSTEM_NARROW_ONLY
@@ -181,11 +181,11 @@
{
if ( !was_error )
{
- if ( &ec != &throws ) ec.clear();
+ if ( &ec != &throws() ) ec.clear();
}
else
{ // error
- if ( &ec == &throws )
+ if ( &ec == &throws() )
throw_exception( filesystem_error( message,
BOOST_ERRNO, system_category ) );
else
@@ -198,11 +198,11 @@
{
if ( !was_error )
{
- if ( &ec != &throws ) ec.clear();
+ if ( &ec != &throws() ) ec.clear();
}
else
{ // error
- if ( &ec == &throws )
+ if ( &ec == &throws() )
throw_exception( filesystem_error( message,
p, BOOST_ERRNO, system_category ) );
else
@@ -216,11 +216,11 @@
{
if ( !was_error )
{
- if ( &ec != &throws ) ec.clear();
+ if ( &ec != &throws() ) ec.clear();
}
else
{ // error
- if ( &ec == &throws )
+ if ( &ec == &throws() )
throw_exception( filesystem_error( message,
p1, p2, BOOST_ERRNO, system_category ) );
else
@@ -231,15 +231,15 @@
bool error( bool was_error, const error_code & result,
const path & p, error_code & ec, const string & message )
- // Overwrites ec if there ahs already been an error
+ // Overwrites ec if there has already been an error
{
if ( !was_error )
{
- if ( &ec != &throws ) ec.clear();
+ if ( &ec != &throws() ) ec.clear();
}
else
{ // error
- if ( &ec == &throws )
+ if ( &ec == &throws() )
throw_exception( filesystem_error( message, p, result ) );
else
ec = result;
@@ -249,15 +249,15 @@
bool error( bool was_error, const error_code & result,
const path & p1, const path & p2, error_code & ec, const string & message )
- // Overwrites ec if there ahs already been an error
+ // Overwrites ec if there has already been an error
{
if ( !was_error )
{
- if ( &ec != &throws ) ec.clear();
+ if ( &ec != &throws() ) ec.clear();
}
else
{ // error
- if ( &ec == &throws )
+ if ( &ec == &throws() )
throw_exception( filesystem_error( message, p1, p2, result ) );
else
ec = result;
@@ -283,7 +283,7 @@
{
if ( sym_stat.type() == fs::file_not_found )
{
- if ( &ec != &throws ) ec.clear();
+ if ( &ec != &throws() ) ec.clear();
return false;
}
@@ -300,7 +300,8 @@
return true;
}
- boost::uintmax_t remove_all_aux( const path & p, fs::file_status sym_stat, error_code & ec )
+ boost::uintmax_t remove_all_aux( const path & p, fs::file_status sym_stat,
+ error_code & ec )
{
static const fs::directory_iterator end_itr;
boost::uintmax_t count = 1;
@@ -312,7 +313,7 @@
itr != end_itr; ++itr )
{
fs::file_status tmp_sym_stat = fs::symlink_status( itr->path(), ec );
- if ( ec && &ec != &throws )
+ if ( &ec != &throws() && ec )
return count;
count += remove_all_aux( itr->path(), tmp_sym_stat, ec );
}
@@ -570,17 +571,21 @@
{
if ( BOOST_CREATE_DIRECTORY( p.c_str() ) )
{
- if ( &ec == &system::throws ) ec.clear();
+ if ( &ec != &boost::throws() ) ec.clear();
return true;
}
- int errval( BOOST_ERRNO );
+
+ // attempt to create directory failed
+ int errval( BOOST_ERRNO ); // save reason for failure
error_code dummy;
if ( errval == BOOST_ERROR_ALREADY_EXISTS && is_directory( p, dummy ) )
{
- if ( &ec == &system::throws ) ec.clear();
+ if ( &ec != &boost::throws() ) ec.clear();
return false;
}
- if ( &ec == &system::throws )
+
+ // attempt to create directory failed && it doesn't already exist
+ if ( &ec == &boost::throws() )
throw_exception( filesystem_error( "boost::filesystem::create_directory",
p, errval, system_category ) );
else
@@ -838,7 +843,7 @@
static path init_path;
if ( init_path.empty() )
init_path = current_path( ec );
- else if ( &ec != &throws ) ec.clear();
+ else if ( &ec != &throws() ) ec.clear();
return init_path;
}
@@ -852,7 +857,7 @@
p, ec, "boost::filesystem::is_empty" ) )
return false;
- if ( &ec != &system::throws ) ec.clear();
+ if ( &ec != &boost::throws() ) ec.clear();
return
( fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
? is_empty_directory( p )
@@ -1036,15 +1041,15 @@
|| (errval == ERROR_BAD_NETPATH)) // "//nosuch" on Win32
{
- if ( &ec != &system::throws ) ec.clear(); // these are not errors
+ if ( &ec != &boost::throws() ) ec.clear(); // these are not errors
return file_status( file_not_found );
}
else if ((errval == ERROR_SHARING_VIOLATION))
{
- if ( &ec != &system::throws ) ec.clear(); // these are not errors
+ if ( &ec != &boost::throws() ) ec.clear(); // these are not errors
return file_status( type_unknown );
}
- if ( &ec == &system::throws )
+ if ( &ec == &boost::throws() )
throw_exception( filesystem_error( "boost::filesystem::status",
p, errval, system_category ) );
else
@@ -1084,7 +1089,7 @@
}
}
- if ( &ec != &system::throws ) ec.clear(); // these are not errors
+ if ( &ec != &boost::throws() ) ec.clear(); // these are not errors
return (attr & FILE_ATTRIBUTE_DIRECTORY)
? file_status( directory_file )
: file_status( regular_file );
@@ -1096,10 +1101,10 @@
{
if ( errno == ENOENT || errno == ENOTDIR )
{
- if ( &ec != &throws ) ec.clear();;
+ if ( &ec != &throws() ) ec.clear();;
return fs::file_status( fs::file_not_found );
}
- if ( &ec != &throws )
+ if ( &ec != &throws() )
ec.assign( errno, system_category );
else
throw_exception( filesystem_error( "boost::filesystem::status",
@@ -1107,7 +1112,7 @@
return fs::file_status( fs::status_unknown );
}
- if ( &ec != &throws ) ec.clear();;
+ if ( &ec != &throws() ) ec.clear();;
if ( S_ISDIR( path_stat.st_mode ) )
return fs::file_status( fs::directory_file );
if ( S_ISREG( path_stat.st_mode ) )
@@ -1139,7 +1144,7 @@
if ( attr & FILE_ATTRIBUTE_REPARSE_POINT ) // aka symlink
return file_status( symlink_file );
- if ( &ec != &system::throws ) ec.clear(); // these are not errors
+ if ( &ec != &boost::throws() ) ec.clear(); // these are not errors
return (attr & FILE_ATTRIBUTE_DIRECTORY)
? file_status( directory_file )
: file_status( regular_file );
@@ -1151,14 +1156,14 @@
{
if ( errno == ENOENT || errno == ENOTDIR ) // these are not errors
{
- if ( &ec != &system::throws ) ec.clear();
+ if ( &ec != &boost::throws() ) ec.clear();
return fs::file_status( fs::file_not_found );
}
- if ( &ec != &system::throws ) ec.assign( errno, system_category );
+ if ( &ec != &boost::throws() ) ec.assign( errno, system_category );
else
return fs::file_status( fs::status_unknown );
}
- if ( &ec != &system::throws ) ec.clear();
+ if ( &ec != &boost::throws() ) ec.clear();
if ( S_ISREG( path_stat.st_mode ) )
return fs::file_status( fs::regular_file );
if ( S_ISDIR( path_stat.st_mode ) )
@@ -1263,11 +1268,11 @@
&& !is_symlink( m_symlink_status ) )
{
m_status = m_symlink_status;
- if ( &ec != &system::throws ) ec.clear();
+ if ( &ec != &boost::throws() ) ec.clear();
}
else m_status = fs::status( m_path, ec );
}
- else if ( &ec != &system::throws ) ec.clear();
+ else if ( &ec != &boost::throws() ) ec.clear();
return m_status;
}
@@ -1276,7 +1281,7 @@
{
if ( !status_known( m_symlink_status ) )
m_symlink_status = fs::symlink_status( m_path, ec );
- else if ( &ec != &system::throws ) ec.clear();
+ else if ( &ec != &boost::throws() ) ec.clear();
return m_symlink_status;
}
@@ -1473,7 +1478,7 @@
// dir_itr_close is called both from the ~dir_itr_imp() destructor
// and dir_itr_increment()
BOOST_FILESYSTEM_DECL
- system::error_code dir_itr_close( // never throws
+ system::error_code dir_itr_close( // never throws()
void *& handle
# if defined(BOOST_POSIX_API)
, void *& buffer
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-01-22 09:54:58 EST (Thu, 22 Jan 2009)
@@ -735,12 +735,13 @@
path_locale() = loc;
wchar_t_codecvt_facet() = &std::use_facet
<std::codecvt<wchar_t, char, std::mbstate_t> >( path_locale() );
- ec.clear();
+ if ( &ec != &boost::throws() ) ec.clear();
return temp;
}
catch (...)
{
assert( 0 && "not implemented yet" ); // TODO
+ return path_locale();
}
}
@@ -789,7 +790,7 @@
assert( 0 && "append error handling not implemented yet" );
throw "append error handling not implemented yet";
}
- if ( &ec != &system::throws ) ec.clear();
+ if ( &ec != &boost::throws() ) ec.clear();
target.append( to, to_next );
}
@@ -806,7 +807,7 @@
if ( begin == end )
{
- if ( &ec != &system::throws ) ec.clear();
+ if ( &ec != &boost::throws() ) ec.clear();
return;
}
@@ -846,7 +847,7 @@
assert( 0 && "convert error handling not implemented yet" );
throw "convert error handling not implemented yet";
}
- if ( &ec != &system::throws ) ec.clear();
+ if ( &ec != &boost::throws() ) ec.clear();
return interface_string_type( to, to_next );
}
@@ -855,7 +856,7 @@
{
if ( src.empty() )
{
- if ( &ec != &system::throws ) ec.clear();
+ if ( &ec != &boost::throws() ) ec.clear();
return interface_string_type();
}
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-01-22 09:54:58 EST (Thu, 22 Jan 2009)
@@ -89,6 +89,7 @@
sys::error_code ec;
fs::recursive_directory_iterator it( "/no-such-path", ec );
BOOST_CHECK( ec );
+
BOOST_CHECK( throws_fs_error(
boost::bind( create_recursive_iterator, "/no-such-path" ) ) );
Modified: sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj 2009-01-22 09:54:58 EST (Thu, 22 Jan 2009)
@@ -182,6 +182,14 @@
RelativePath="..\..\..\src\path.cpp"
>
</File>
+ <File
+ RelativePath="..\..\..\src\portability.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
Modified: sandbox/filesystem-v3/libs/filesystem/test/msvc/path_test/path_test.vcproj
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/msvc/path_test/path_test.vcproj (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/msvc/path_test/path_test.vcproj 2009-01-22 09:54:58 EST (Thu, 22 Jan 2009)
@@ -188,6 +188,10 @@
RelativePath="..\..\path_test.cpp"
>
</File>
+ <File
+ RelativePath="..\..\..\src\portability.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
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