|
Boost-Commit : |
From: bdawes_at_[hidden]
Date: 2008-07-10 21:16:23
Author: bemandawes
Date: 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
New Revision: 47299
URL: http://svn.boost.org/trac/boost/changeset/47299
Log:
Merge accumulated changes from trunk
Added:
branches/release/libs/filesystem/test/msvc/
- copied from r47298, /trunk/libs/filesystem/test/msvc/
branches/release/libs/filesystem/test/msvc/boost_filesystem.sln
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/boost_filesystem.sln
branches/release/libs/filesystem/test/msvc/common.vsprops
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/common.vsprops
branches/release/libs/filesystem/test/msvc/convenience_test/
- copied from r47298, /trunk/libs/filesystem/test/msvc/convenience_test/
branches/release/libs/filesystem/test/msvc/convenience_test/convenience_test.vcproj
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/convenience_test/convenience_test.vcproj
branches/release/libs/filesystem/test/msvc/filesystem_dll/
- copied from r47298, /trunk/libs/filesystem/test/msvc/filesystem_dll/
branches/release/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj
branches/release/libs/filesystem/test/msvc/fstream_test/
- copied from r47298, /trunk/libs/filesystem/test/msvc/fstream_test/
branches/release/libs/filesystem/test/msvc/fstream_test/fstream_test.vcproj
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/fstream_test/fstream_test.vcproj
branches/release/libs/filesystem/test/msvc/large_file_support_test/
- copied from r47298, /trunk/libs/filesystem/test/msvc/large_file_support_test/
branches/release/libs/filesystem/test/msvc/large_file_support_test/large_file_support_test.vcproj
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/large_file_support_test/large_file_support_test.vcproj
branches/release/libs/filesystem/test/msvc/mbcopy/
- copied from r47298, /trunk/libs/filesystem/test/msvc/mbcopy/
branches/release/libs/filesystem/test/msvc/mbcopy/mbcopy.vcproj
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/mbcopy/mbcopy.vcproj
branches/release/libs/filesystem/test/msvc/mbpath/
- copied from r47298, /trunk/libs/filesystem/test/msvc/mbpath/
branches/release/libs/filesystem/test/msvc/mbpath/mbpath.vcproj
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/mbpath/mbpath.vcproj
branches/release/libs/filesystem/test/msvc/operations_test/
- copied from r47298, /trunk/libs/filesystem/test/msvc/operations_test/
branches/release/libs/filesystem/test/msvc/operations_test/operations_test.vcproj
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/operations_test/operations_test.vcproj
branches/release/libs/filesystem/test/msvc/path_test/
- copied from r47298, /trunk/libs/filesystem/test/msvc/path_test/
branches/release/libs/filesystem/test/msvc/path_test/path_test.vcproj
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/path_test/path_test.vcproj
branches/release/libs/filesystem/test/msvc/simple_ls/
- copied from r47298, /trunk/libs/filesystem/test/msvc/simple_ls/
branches/release/libs/filesystem/test/msvc/simple_ls/simple_ls.vcproj
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/simple_ls/simple_ls.vcproj
branches/release/libs/filesystem/test/msvc/system_dll/
- copied from r47298, /trunk/libs/filesystem/test/msvc/system_dll/
branches/release/libs/filesystem/test/msvc/system_dll/system_dll.vcproj
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/system_dll/system_dll.vcproj
branches/release/libs/filesystem/test/msvc/wide_test/
- copied from r47298, /trunk/libs/filesystem/test/msvc/wide_test/
branches/release/libs/filesystem/test/msvc/wide_test/wide_test.vcproj
- copied unchanged from r47298, /trunk/libs/filesystem/test/msvc/wide_test/wide_test.vcproj
Removed:
branches/release/libs/filesystem/src/exception.cpp
Text files modified:
branches/release/boost/filesystem/convenience.hpp | 21 +-
branches/release/boost/filesystem/operations.hpp | 71 ++++++---
branches/release/boost/filesystem/path.hpp | 128 +++++++++++++-----
branches/release/libs/filesystem/doc/index.htm | 4
branches/release/libs/filesystem/doc/reference.html | 237 ++++++++++++++++++---------------
branches/release/libs/filesystem/example/mbcopy.cpp | 4
branches/release/libs/filesystem/example/mbpath.cpp | 4
branches/release/libs/filesystem/example/simple_ls.cpp | 10
branches/release/libs/filesystem/src/operations.cpp | 131 ++++++++++--------
branches/release/libs/filesystem/src/path.cpp | 2
branches/release/libs/filesystem/src/utf8_codecvt_facet.hpp | 2
branches/release/libs/filesystem/test/convenience_test.cpp | 7
branches/release/libs/filesystem/test/equivalent.cpp | 2
branches/release/libs/filesystem/test/fstream_test.cpp | 9 -
branches/release/libs/filesystem/test/lpath.hpp | 1
branches/release/libs/filesystem/test/operations_test.cpp | 182 ++++++++++++++-----------
branches/release/libs/filesystem/test/path_test.cpp | 280 +++++++++++++++++++++++----------------
branches/release/libs/filesystem/test/wide_test.cpp | 10 -
18 files changed, 637 insertions(+), 468 deletions(-)
Modified: branches/release/boost/filesystem/convenience.hpp
==============================================================================
--- branches/release/boost/filesystem/convenience.hpp (original)
+++ branches/release/boost/filesystem/convenience.hpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -50,20 +50,22 @@
}
// First create branch, by calling ourself recursively
- create_directories(ph.branch_path());
+ create_directories(ph.parent_path());
// Now that parent's path exists, create the directory
create_directory(ph);
return true;
}
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+
BOOST_FS_FUNC_STRING extension(const Path& ph)
{
typedef BOOST_FS_TYPENAME Path::string_type string_type;
- string_type leaf = ph.leaf();
+ string_type filename = ph.filename();
- BOOST_FS_TYPENAME string_type::size_type n = leaf.rfind('.');
+ BOOST_FS_TYPENAME string_type::size_type n = filename.rfind('.');
if (n != string_type::npos)
- return leaf.substr(n);
+ return filename.substr(n);
else
return string_type();
}
@@ -71,14 +73,17 @@
BOOST_FS_FUNC_STRING basename(const Path& ph)
{
typedef BOOST_FS_TYPENAME Path::string_type string_type;
- string_type leaf = ph.leaf();
- BOOST_FS_TYPENAME string_type::size_type n = leaf.rfind('.');
- return leaf.substr(0, n);
+ string_type filename = ph.filename();
+ BOOST_FS_TYPENAME string_type::size_type n = filename.rfind('.');
+ return filename.substr(0, n);
}
+
BOOST_FS_FUNC(Path) change_extension( const Path & ph,
const BOOST_FS_TYPENAME Path::string_type & new_extension )
- { return ph.branch_path() / (basename(ph) + new_extension); }
+ { return ph.parent_path() / (basename(ph) + new_extension); }
+
+# endif
# ifndef BOOST_FILESYSTEM_NARROW_ONLY
Modified: branches/release/boost/filesystem/operations.hpp
==============================================================================
--- branches/release/boost/filesystem/operations.hpp (original)
+++ branches/release/boost/filesystem/operations.hpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -102,10 +102,14 @@
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 is_regular( file_status f ) { return f.type() == regular_file; }
+ 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(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; }
+# endif
struct space_info
{
@@ -117,6 +121,10 @@
namespace detail
{
+ // singular object used only as a tag; thus initialization and
+ // thread-safety are not issues
+ BOOST_FILESYSTEM_DECL extern system::error_code throws;
+
typedef std::pair< system::error_code, bool >
query_pair;
@@ -275,7 +283,7 @@
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline bool symbolic_link_exists( const path & ph )
{ return is_symlink( symlink_status(ph) ); }
-#endif
+# endif
BOOST_FS_FUNC(bool) exists( const Path & ph )
{
@@ -297,6 +305,17 @@
return is_directory( result );
}
+ BOOST_FS_FUNC(bool) is_regular_file( const Path & ph )
+ {
+ system::error_code ec;
+ file_status result( detail::status_api( ph.external_file_string(), ec ) );
+ if ( ec )
+ boost::throw_exception( basic_filesystem_error<Path>(
+ "boost::filesystem::is_regular_file", ph, ec ) );
+ return is_regular_file( result );
+ }
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
BOOST_FS_FUNC(bool) is_regular( const Path & ph )
{
system::error_code ec;
@@ -306,6 +325,7 @@
"boost::filesystem::is_regular", ph, ec ) );
return is_regular( result );
}
+# endif
BOOST_FS_FUNC(bool) is_other( const Path & ph )
{
@@ -454,21 +474,13 @@
return ec;
}
- BOOST_FS_FUNC(bool) remove( const Path & ph )
+ BOOST_FS_FUNC(void) remove( const Path & ph, system::error_code & ec = detail::throws )
{
- if ( exists( ph )
- || is_symlink( ph ) ) // handle dangling symbolic links
- // note that the POSIX behavior for symbolic links is what we want;
- // the link rather than what it points to is deleted. Windows behavior
- // doesn't matter; is_symlink() is always false on Windows.
- {
- system::error_code ec( detail::remove_api( ph.external_file_string() ) );
- if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
- "boost::filesystem::remove", ph, ec ) );
- return true;
- }
- return false;
+ system::error_code error( detail::remove_api(ph.external_file_string()) );
+ if ( error && &ec == &detail::throws )
+ boost::throw_exception( basic_filesystem_error<Path>(
+ "boost::filesystem::remove", ph, error ) );
+ ec = error;
}
BOOST_FS_FUNC(unsigned long) remove_all( const Path & ph )
@@ -618,10 +630,17 @@
inline bool is_directory( const wpath & ph )
{ return is_directory<wpath>( ph ); }
+ inline bool is_regular_file( const path & ph )
+ { return is_regular_file<path>( ph ); }
+ inline bool is_regular_file( const wpath & ph )
+ { return is_regular_file<wpath>( ph ); }
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline bool is_regular( const path & ph )
{ return is_regular<path>( ph ); }
inline bool is_regular( const wpath & ph )
{ return is_regular<wpath>( ph ); }
+# endif
inline bool is_other( const path & ph )
{ return is_other<path>( ph ); }
@@ -693,10 +712,8 @@
const wpath & from_ph, system::error_code & ec )
{ return create_symlink<wpath>( to_ph, from_ph, ec ); }
- inline bool remove( const path & ph )
- { return remove<path>( ph ); }
- inline bool remove( const wpath & ph )
- { return remove<wpath>( ph ); }
+ inline void remove( const path & ph ) { remove<path>( ph ); }
+ inline void remove( const wpath & ph ) { remove<wpath>( ph ); }
inline unsigned long remove_all( const path & ph )
{ return remove_all<path>( ph ); }
@@ -965,7 +982,7 @@
{
boost::throw_exception( basic_filesystem_error<Path>(
"boost::filesystem::basic_directory_iterator increment",
- m_imp->m_directory_entry.path().branch_path(), ec ) );
+ m_imp->m_directory_entry.path().parent_path(), ec ) );
}
if ( m_imp->m_handle == 0 ) { m_imp.reset(); return; } // eof, make end
if ( !(name[0] == dot<Path>::value // !(dot or dot-dot)
@@ -973,7 +990,7 @@
|| (name[1] == dot<Path>::value
&& name.size() == 2))) )
{
- m_imp->m_directory_entry.replace_leaf(
+ m_imp->m_directory_entry.replace_filename(
Path::traits_type::to_internal( name ), fs, symlink_fs );
return;
}
@@ -1001,10 +1018,10 @@
file_status st, file_status symlink_st )
{ m_path = p; m_status = st; m_symlink_status = symlink_st; }
- void replace_leaf( const string_type & s,
+ void replace_filename( const string_type & s,
file_status st, file_status symlink_st )
{
- m_path.remove_leaf();
+ m_path.remove_filename();
m_path /= s;
m_status = st;
m_symlink_status = symlink_st;
@@ -1021,9 +1038,9 @@
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
// deprecated functions preserve common use cases in legacy code
- typename Path::string_type leaf() const
+ typename Path::string_type filename() const
{
- return path().leaf();
+ return path().filename();
}
typename Path::string_type string() const
{
Modified: branches/release/boost/filesystem/path.hpp
==============================================================================
--- branches/release/boost/filesystem/path.hpp (original)
+++ branches/release/boost/filesystem/path.hpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -1,12 +1,17 @@
// boost/filesystem/path.hpp -----------------------------------------------//
// Copyright Beman Dawes 2002-2005
+// Copyright Vladimir Prus 2002
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See library home page at http://www.boost.org/libs/filesystem
+// basic_path's stem(), extension(), and replace_extension() are based on
+// basename(), extension(), and change_extension() from the original
+// filesystem/convenience.hpp header by Vladimir Prus.
+
//----------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_PATH_HPP
@@ -197,7 +202,12 @@
# endif
}
- basic_path & remove_leaf();
+ basic_path & remove_filename();
+ basic_path & replace_extension( const string_type & new_extension = "" );
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+ basic_path & remove_leaf() { return remove_filename(); }
+# endif
// observers
const string_type & string() const { return m_path; }
@@ -211,8 +221,15 @@
string_type root_name() const;
string_type root_directory() const;
basic_path relative_path() const;
- string_type leaf() const;
- basic_path branch_path() const;
+ basic_path parent_path() const;
+ string_type filename() const;
+ string_type stem() const;
+ string_type extension() const;
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+ string_type leaf() const { return filename(); }
+ basic_path branch_path() const { return parent_path(); }
+# endif
bool empty() const { return m_path.empty(); } // name consistent with std containers
bool is_complete() const;
@@ -220,8 +237,8 @@
bool has_root_name() const;
bool has_root_directory() const;
bool has_relative_path() const { return !relative_path().empty(); }
- bool has_leaf() const { return !m_path.empty(); }
- bool has_branch_path() const { return !branch_path().empty(); }
+ bool has_filename() const { return !m_path.empty(); }
+ bool has_parent_path() const { return !parent_path().empty(); }
// iterators
class iterator : public boost::iterator_facade<
@@ -624,14 +641,14 @@
typedef Path path_type;
- basic_filesystem_error( const std::string & what,
+ basic_filesystem_error( const std::string & what_arg,
system::error_code ec );
- basic_filesystem_error( const std::string & what,
- const path_type & path1, system::error_code ec );
+ basic_filesystem_error( const std::string & what_arg,
+ const path_type & path1_arg, system::error_code ec );
- basic_filesystem_error( const std::string & what, const path_type & path1,
- const path_type & path2, system::error_code ec );
+ basic_filesystem_error( const std::string & what_arg, const path_type & path1_arg,
+ const path_type & path2_arg, system::error_code ec );
~basic_filesystem_error() throw() {}
@@ -698,13 +715,13 @@
;
}
- // leaf_pos helper ----------------------------------------------------//
+ // filename_pos helper ----------------------------------------------------//
template<class String, class Traits>
- typename String::size_type leaf_pos(
+ typename String::size_type filename_pos(
const String & str, // precondition: portable generic path grammar
typename String::size_type end_pos ) // end_pos is past-the-end position
- // return 0 if str itself is leaf (or empty)
+ // return 0 if str itself is filename (or empty)
{
typedef typename
boost::BOOST_FILESYSTEM_NAMESPACE::basic_path<String, Traits> path_type;
@@ -728,9 +745,9 @@
pos = str.find_last_of( colon<path_type>::value, end_pos-2 );
# endif
- return ( pos == String::npos // path itself must be a leaf (or empty)
+ return ( pos == String::npos // path itself must be a filename (or empty)
|| (pos == 1 && str[0] == slash<path_type>::value) ) // or net
- ? 0 // so leaf is entire string
+ ? 0 // so filename is entire string
: pos + 1; // or starts after delimiter
}
@@ -876,10 +893,10 @@
// decomposition functions ----------------------------------------------//
template<class String, class Traits>
- String basic_path<String, Traits>::leaf() const
+ String basic_path<String, Traits>::filename() const
{
typename String::size_type end_pos(
- detail::leaf_pos<String, Traits>( m_path, m_path.size() ) );
+ detail::filename_pos<String, Traits>( m_path, m_path.size() ) );
return (m_path.size()
&& end_pos
&& m_path[end_pos] == slash<path_type>::value
@@ -889,12 +906,31 @@
}
template<class String, class Traits>
- basic_path<String, Traits> basic_path<String, Traits>::branch_path() const
+ String basic_path<String, Traits>::stem() const
+ {
+ string_type name = filename();
+ typename string_type::size_type n = name.rfind('.');
+ return name.substr(0, n);
+ }
+
+ template<class String, class Traits>
+ String basic_path<String, Traits>::extension() const
+ {
+ string_type name = filename();
+ typename string_type::size_type n = name.rfind('.');
+ if (n != string_type::npos)
+ return name.substr(n);
+ else
+ return string_type();
+ }
+
+ template<class String, class Traits>
+ basic_path<String, Traits> basic_path<String, Traits>::parent_path() const
{
typename String::size_type end_pos(
- detail::leaf_pos<String, Traits>( m_path, m_path.size() ) );
+ detail::filename_pos<String, Traits>( m_path, m_path.size() ) );
- bool leaf_was_separator( m_path.size()
+ bool filename_was_separator( m_path.size()
&& m_path[end_pos] == slash<path_type>::value );
// skip separators unless root directory
@@ -907,7 +943,7 @@
;
--end_pos ) {}
- return (end_pos == 1 && root_dir_pos == 0 && leaf_was_separator)
+ return (end_pos == 1 && root_dir_pos == 0 && filename_was_separator)
? path_type()
: path_type( m_path.substr( 0, end_pos ) );
}
@@ -1137,7 +1173,7 @@
&& (*itr)[0] == dot<path_type>::value
&& (*itr)[1] == dot<path_type>::value ) // dot dot
{
- string_type lf( temp.leaf() );
+ string_type lf( temp.filename() );
if ( lf.size() > 0
&& (lf.size() != 1
|| (lf[0] != dot<path_type>::value
@@ -1152,7 +1188,7 @@
)
)
{
- temp.remove_leaf();
+ temp.remove_filename();
// if not root directory, must also remove "/" if any
if ( temp.m_path.size() > 0
&& temp.m_path[temp.m_path.size()-1]
@@ -1183,16 +1219,34 @@
# endif
- // remove_leaf ----------------------------------------------------------//
+ // modifiers ------------------------------------------------------------//
template<class String, class Traits>
- basic_path<String, Traits> & basic_path<String, Traits>::remove_leaf()
+ basic_path<String, Traits> & basic_path<String, Traits>::remove_filename()
{
m_path.erase(
- detail::leaf_pos<String, Traits>( m_path, m_path.size() ) );
+ detail::filename_pos<String, Traits>( m_path, m_path.size() ) );
+ return *this;
+ }
+
+ template<class String, class Traits>
+ basic_path<String, Traits> &
+ basic_path<String, Traits>::replace_extension( const string_type & new_ext )
+ {
+ // erase existing extension if any
+ string_type old_ext = extension();
+ if ( !old_ext.empty() )
+ m_path.erase( m_path.size() - old_ext.size() );
+
+ if ( !new_ext.empty() && new_ext[0] != dot<path_type>::value )
+ m_path += dot<path_type>::value;
+
+ m_path += new_ext;
+
return *this;
}
+
// path conversion functions --------------------------------------------//
template<class String, class Traits>
@@ -1375,7 +1429,7 @@
;
--end_pos ) {}
- itr.m_pos = detail::leaf_pos<string_type, traits_type>
+ itr.m_pos = detail::filename_pos<string_type, traits_type>
( itr.m_path_ptr->m_path, end_pos );
itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos );
}
@@ -1385,8 +1439,8 @@
template<class Path>
basic_filesystem_error<Path>::basic_filesystem_error(
- const std::string & what, system::error_code ec )
- : system::system_error(ec, what)
+ const std::string & what_arg, system::error_code ec )
+ : system::system_error(ec, what_arg)
{
try
{
@@ -1397,29 +1451,29 @@
template<class Path>
basic_filesystem_error<Path>::basic_filesystem_error(
- const std::string & what, const path_type & path1,
+ const std::string & what_arg, const path_type & path1_arg,
system::error_code ec )
- : system::system_error(ec, what)
+ : system::system_error(ec, what_arg)
{
try
{
m_imp_ptr.reset( new m_imp );
- m_imp_ptr->m_path1 = path1;
+ m_imp_ptr->m_path1 = path1_arg;
}
catch (...) { m_imp_ptr.reset(); }
}
template<class Path>
basic_filesystem_error<Path>::basic_filesystem_error(
- const std::string & what, const path_type & path1,
- const path_type & path2, system::error_code ec )
- : system::system_error(ec, what)
+ const std::string & what_arg, const path_type & path1_arg,
+ const path_type & path2_arg, system::error_code ec )
+ : system::system_error(ec, what_arg)
{
try
{
m_imp_ptr.reset( new m_imp );
- m_imp_ptr->m_path1 = path1;
- m_imp_ptr->m_path2 = path2;
+ m_imp_ptr->m_path1 = path1_arg;
+ m_imp_ptr->m_path2 = path2_arg;
}
catch (...) { m_imp_ptr.reset(); }
}
Modified: branches/release/libs/filesystem/doc/index.htm
==============================================================================
--- branches/release/libs/filesystem/doc/index.htm (original)
+++ branches/release/libs/filesystem/doc/index.htm 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -332,7 +332,7 @@
systems which will work with the Filesystem Library.</p>
<p>The object-library can be built for static or dynamic (shared/dll) linking.
This is controlled by the BOOST_ALL_DYN_LINK or BOOST_FILESYSTEM_DYN_LINK
-macros. See the <a href="http://www.boost.org/more/separate_compilation.html">Separate
+macros. See the <a href="http://www.boost.org/development/separate_compilation.html">Separate
Compilation</a> page for a description of the techniques used.</p>
<h3>Note for <a name="Cgywin">Cygwin</a> users</h3>
<p>The library's implementation code automatically detects the current platform,
@@ -562,4 +562,4 @@
</body>
-</html>
\ No newline at end of file
+</html>
Modified: branches/release/libs/filesystem/doc/reference.html
==============================================================================
--- branches/release/libs/filesystem/doc/reference.html (original)
+++ branches/release/libs/filesystem/doc/reference.html 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -123,7 +123,6 @@
</code>
<a href="#Suggestions-for-fstream"> implementations</a><br>
<a href="#Path-decomposition-table">Path decomposition table</a><br>
-Issues<br>
<a href="#Acknowledgements">Acknowledgements</a><br>
<a href="#References">References</a><br>
</td>
@@ -369,14 +368,14 @@
// predicate functions
bool status_known( file_status s );
bool exists( file_status s );
- bool is_regular( file_status s );
+ bool is_regular_file( file_status s );
bool is_directory( file_status s );
bool is_symlink( file_status s );
bool is_other( file_status s );
template <class Path> bool exists(const Path& p);
template <class Path> bool is_directory(const Path& p);
- template <class Path> bool is_regular(const Path& p);
+ template <class Path> bool is_regular_file(const Path& p);
template <class Path> bool is_other(const Path& p);
template <class Path> bool is_symlink(const Path& p);
template <class Path> bool is_empty(const Path& p);
@@ -417,7 +416,7 @@
template <class Path> typename Path::string_type extension(const Path& p);
template <class Path> typename Path::string_type basename(const Path& p);
template <class Path>
- Path replace_extension(const Path& p, const typename Path::string_type& new_extension);
+ Path change_extension(const Path& p, const typename Path::string_type& new_extension);
} // namespace filesystem
} // namespace boost</pre>
@@ -547,7 +546,8 @@
<span style="background-color: #FFFFFF">void clear();
void swap( basic_path & rhs );</span>
- basic_path& remove_leaf();
+ basic_path& remove_filename();
+ basic_path& replace_extension(const string_type & new_extension = "");
// observers
const string_type string() const;
@@ -561,8 +561,12 @@
string_type root_directory() const;
basic_path root_path() const;
basic_path relative_path() const;
- string_type leaf() const;
- basic_path branch_path() const;
+
+ basic_path parent_path() const;
+ string_type filename() const;
+
+ string_type stem() const;
+ string_type extension() const;
bool empty() const;
bool is_complete() const;
@@ -570,8 +574,8 @@
bool has_root_directory() const;
bool has_root_path() const;
bool has_relative_path() const;
- bool has_leaf() const;
- bool has_branch_path() const;
+ bool has_filename() const;
+ bool has_parent_path() const;
// iterators
class iterator;
@@ -856,9 +860,9 @@
<p><i><span style="background-color: #FFFFFF">Complexity: </span></i>
<span style="background-color: #FFFFFF">constant time.</span></p>
</blockquote>
-<pre>basic_path& remove_leaf();</pre>
+<pre>basic_path& remove_filename();</pre>
<blockquote>
- <p><i>Effects:</i> If <code>has_branch_path()</code> then remove the last <i>filename</i> from the stored path. If that leaves
+ <p><i>Effects:</i> If <code>has_parent_path()</code> then remove the last <i>filename</i> from the stored path. If that leaves
the stored path with one or more trailing <i>slash</i> elements not
representing <i>root-directory</i>, remove them.</p>
<p><i>Returns:</i> <code>*this</code></p>
@@ -866,6 +870,15 @@
basic_directory_iterator</code>. It is made public to allow additional uses. <i>-- end
note</i>]</p>
</blockquote>
+<pre>basic_path& replace_extension( const string_type & new_extension = "" );</pre>
+<blockquote>
+ <p><i>Postcondition: </i> <code>extension() == <i>replacement</i></code>,
+ where <code><i>replacement</i></code> is <code>new_extension</code> if <code>
+ new_extension.empty() || new_extension[0] ==</code> the dot character,
+ otherwise <code><i>replacement</i></code> is the dot character followed by
+ <code>new_extension</code>.</p>
+ <p><i>Returns:</i> <code>*this</code></p>
+</blockquote>
<h4> <a name="basic_path-observers"> <code>basic_path</code> observers</a></h4>
<blockquote>
<p><span style="background-color: #E0E0E0"><i>See the
@@ -931,11 +944,11 @@
with the first <i>filename</i> after <i>root-path</i>.
Otherwise, an empty <code>basic_path</code>.</p>
</blockquote>
-<pre>string_type leaf() const;</pre>
+<pre>string_type filename() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>empty() ? string_type() : *--end()</code></p>
</blockquote>
-<pre>basic_path branch_path() const;</pre>
+<pre>basic_path parent_path() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>(string().empty() || begin() == --end()) ? path_type("") :
<i>br</i></code>, where <code><i>br</i></code> is constructed as if by
@@ -943,6 +956,25 @@
operator/=</code> for each element in the range <code>begin()</code>, <code>
--end()</code>.</p>
</blockquote>
+<pre>string_type stem(const Path & p) const;</pre>
+<blockquote>
+ <p><i>Returns:</i> if <code>p.filename()</code> contains a <i>dot</i>, returns
+ the substring of <code>p.filename()</code> starting at its beginning and
+ ending at the last <i>dot</i> (the <i>dot</i> is not included). Otherwise,
+ returns <code>
+ p.filename()</code>.</p>
+</blockquote>
+<pre>string_type extension(const Path & p) const;</pre>
+<blockquote>
+ <p><i>Returns:</i> if <code>p.filename()</code> contains a <i>dot</i>, returns
+ the substring of <code>p.filename()</code> starting at the rightmost <i>dot</i>
+ and ending at the string's end. Otherwise, returns an empty string. </p>
+ <p>[<i>Note:<b> </b></i>The <i>dot</i> is included in the return value so that
+ it is possible to distinguish between no extension and an empty extension. </p>
+ <p>Implementations are permitted but not required to define additional
+ behavior for file systems which append additional elements to extensions, such
+ as alternate data stream or partitioned dataset names. <i>-- end note</i>]</p>
+</blockquote>
<pre>bool empty() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>string().empty()</code>.</p>
@@ -968,13 +1000,13 @@
<blockquote>
<p><i>Returns:</i> <code>!relative_path().empty()</code></p>
</blockquote>
-<pre>bool has_leaf() const;</pre>
+<pre>bool has_filename() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>!leaf().empty()</code></p>
+ <p><i>Returns:</i> <code>!filename().empty()</code></p>
</blockquote>
-<pre>bool has_branch_path() const;</pre>
+<pre>bool has_parent_path() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>!branch_path().empty()</code></p>
+ <p><i>Returns:</i> <code>!parent_path().empty()</code></p>
</blockquote>
<h4> <a name="basic_path-iterators"> <code>basic_path</code> iterators</a></h4>
<p> A <code>basic_path::iterator</code> is a constant iterator satisfying all
@@ -1099,7 +1131,7 @@
<span style="background-color: #FFFFFF">basic_path<String, Traits></span></code></td>
<td width="55%" height="30"><code><span style="background-color: #FFFFFF">
basic_path<String, Traits> tmp(a);<br>
- return a /= </span></code><i><b><span style="background-color: #FFFFFF">b'</span></b></i><code><span style="background-color: #FFFFFF">;</span></code></td>
+ return tmp /= </span></code><i><b><span style="background-color: #FFFFFF">b'</span></b></i><code><span style="background-color: #FFFFFF">;</span></code></td>
</tr>
<tr>
<td width="20%" align="center" height="19" valign="top"><code>
@@ -1364,7 +1396,7 @@
// modifiers
void assign(const path_type& p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
- void replace_leaf(const string_type& s, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
+ void replace_filename(const string_type& s, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
// observers
const Path& path() const;
@@ -1474,7 +1506,7 @@
</tr>
</table>
</blockquote>
-<pre>void replace_leaf(const string_type& s, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());</pre>
+<pre>void replace_filename(const string_type& s, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="43%">
@@ -1645,8 +1677,8 @@
{
for (directory_iterator itr(p); itr!=directory_iterator(); ++itr)
{
- cout << itr->path().leaf() << ' '; // display filename only
- if (is_regular(itr->status())) cout << " [" << file_size(itr->path()) << ']';
+ cout << itr->path().filename() << ' '; // display filename only
+ if (is_regular_file(itr->status())) cout << " [" << file_size(itr->path()) << ']';
cout << '\n';
}
}
@@ -1807,11 +1839,11 @@
<blockquote>
<p><i>Returns:</i></p>
<blockquote>
- For <code>status,</code> determine the attributes
+ For <code>status</code>, determine the attributes
of
<code>p</code> as if by<i> POSIX </i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">stat()</a></code>,
- for <code>symlink_status</code> determine the attributes as if by <i>POSIX </i> <code>
+ for <code>symlink_status</code>, determine the attributes as if by <i>POSIX </i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/lstat.html">
lstat()</a></code>.<blockquote>
<p>[<i>Note:</i> For symbolic links, <code>stat()</code> continues
@@ -1819,14 +1851,23 @@
does not. <i>--
end note</i>]</p>
</blockquote>
- <p>If the operating system reports an error during attribute determination:</p>
+ <p>If the underlying file system reports an error during attribute determination:</p>
<ul>
- <li>If the error indicating that <code>p</code> could not
- be resolved, as if by POSIX error codes ENOENT or ENOTDIR, set ec to 0 and return <code>
+ <li>If the error indicating that <code>p</code> could not be resolved, as
+ if by POSIX errors ENOENT or ENOTDIR, call <code>ec.clear()</code> and return <code>
file_status(not_found_flag)</code>.</li>
</ul>
+ <blockquote>
+ <blockquote>
+ <p>[<i>Note:</i> The effect of this behavior is to distinguish between
+ knowing that p
+ does not exist, and not being able to determine the status of p. This
+ distinction is important to users. <i>--end note</i>]</p>
+ </blockquote>
+ </blockquote>
<ul>
- <li>Otherwise, set ec to the error code reported by the operating system
+ <li>Otherwise, set ec to the error number reported by the underlying
+ implementation API
and return <code>
file_status(status_unknown)</code>.</li>
</ul>
@@ -1899,14 +1940,14 @@
<blockquote>
<p><i>Returns:</i> <code>exists( status(p) )</code></p>
</blockquote>
-<pre><span style="background-color: #FFFFFF">bool </span><code><span style="background-color: #FFFFFF">is_regular</span></code><span style="background-color: #FFFFFF">(file_status</span><span style="background-color: #FFFFFF"> s);</span></pre>
+<pre><span style="background-color: #FFFFFF">bool </span><code><span style="background-color: #FFFFFF">is_regular_file</span></code><span style="background-color: #FFFFFF">(file_status</span><span style="background-color: #FFFFFF"> s);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
<code>s.type() == regular_file</code></span></p>
</blockquote>
-<pre><code>template <class Path> bool is_regular(const Path& p);</code></pre>
+<pre><code>template <class Path> bool is_regular_file(const Path& p);</code></pre>
<blockquote>
- <p><i>Returns:</i> <code>is_regular( status(p) )</code></p>
+ <p><i>Returns:</i> <code>is_regular_file( status(p) )</code></p>
</blockquote>
<pre><span style="background-color: #FFFFFF">bool </span><code><span style="background-color: #FFFFFF">is_directory</span></code><span style="background-color: #FFFFFF">(file_status</span><span style="background-color: #FFFFFF"> s);</span></pre>
<blockquote>
@@ -1929,7 +1970,7 @@
<pre><span style="background-color: #FFFFFF">bool <a name="exists">is_other</a>(file_status s);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
- <code>return exists(s) && !is_regular(s) && !is_directory(s) && !is_symlink(s)</code></span></p>
+ <code>return exists(s) && !is_regular_file(s) && !is_directory(s) && !is_symlink(s)</code></span></p>
<p><span style="background-color: #FFFFFF">[<i>Note: </i>The specification of
<code>is_other()</code> will remain unchanged even if additional <code>is_xxx()</code>
functions are added in the future. <i>-- end note</i>]</span></p>
@@ -2154,24 +2195,38 @@
</span> <code>basic_filesystem_error<Path1, Path2></code><span style="background-color: #FFFFFF">
if <code>ec</code> is not zero.</span></p>
</blockquote>
-<pre>template <class Path> bool remove(const Path& p);</pre>
+<pre>template <class Path> void remove(const Path& p, system::error_code & ec = <i>singular</i> );</pre>
<blockquote>
- <p><i>Precondition:</i> <code>!p.empty()</code></p>
- <p><i>Effects:</i> Attempts to delete the file <code>p</code> resolves
- to,
+ <p><i>Effects:</i> Removes the file <code>p</code>,
as if by<i> POSIX </i><code>
- <a href="http://www.opengroup.org/onlinepubs/000095399/functions/link.html">
- remove()</a></code>.</p>
- <p><i>Returns:</i> The value of <code>exists(p)</code> prior to the
- establishment of the postcondition.</p>
- <p><i>Postcondition:</i> <code>!exists(p)</code></p>
- <p><i>Throws:</i> <code>basic_filesystem_error<Path></code> if:</p>
+ remove()</code>.
+ If no error is reported by the underlying removal implementation or if <code>
+ status(p).type() == file_not_found</code>, then:</p>
<ul>
- <li><code>p.empty() || (exists(p) && is_directory(p) && !empty(p))</code>.</li>
- <li><i>Effects</i> fails for any reason other than because <code>p</code>
- does not resolve to an existing file.</li>
+ <li>if <code>ec != </code><i><code>singular</code></i>, then <code>ec.clear()</code>.</li>
</ul>
- <p>[<i>Note:</i> A symbolic link is itself removed, rather than what it
+ <p>Otherwise,</p>
+ <ul>
+ <li>if <code>ec != </code><i><code>singular</code></i>, then set <code>ec</code>
+ to represent the error.</li>
+ <li>otherwise, throw <code>basic_filesystem_error<Path></code> to represent
+ the error.if <code>ec != </code><i><code>singular</code></i>, then <code>
+ ec.clear()</code></li>
+ </ul>
+ <p><i>Postcondition:</i> <code>!exists(p)</code></p>
+ <p><i>Throws:</i> See <i>Effects</i>.</p>
+ <p>[<i>Note:</i> A symbolic link is itself removed, rather than the file it
+ resolves to being removed. <i>-- end note</i>]</p>
+</blockquote>
+<pre>template <class Path> unsigned long remove_all(const Path& p);</pre>
+<blockquote>
+ <p><i>Effects:</i> Recursively deletes the contents of p if it exists,
+ then deletes file <code>p</code> itself,
+ as if by<i> POSIX </i><code>
+ remove()</code>.</p>
+ <p><i>Returns:</i> The number of files removed.</p>
+ <p><i>Postcondition:</i> <code>!exists(p)</code></p>
+ <p>[<i>Note:</i> A symbolic link is itself removed, rather than the file it
resolves to being removed. <i>-- end note</i>]</p>
</blockquote>
<pre>template <class Path1, class Path2> void rename(const Path1& from_p, const Path2& to_p);</pre>
@@ -2197,7 +2252,7 @@
<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>Throws:</i> <code>basic_filesystem_error<Path></code> if <code>
- from_fp.empty() || to_fp.empty() ||!exists(from_fp) || !is_regular(from_fp)
+ from_fp.empty() || to_fp.empty() ||!exists(from_fp) || !is_regular_file(from_fp)
|| exists(to_fp)</code></p>
</blockquote>
<pre>template <class Path> Path complete(const Path& p, const Path& base=initial_path<Path>());</pre>
@@ -2275,11 +2330,18 @@
<p><i>Throws:</i> <code>basic_filesystem_error<Path></code> if<code>
exists(p) && !is_directory(p)</code></p>
</blockquote>
+<table border="1" cellpadding="5" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111">
+ <tr>
+ <td>
+ <h4>Deprecated convenience functions</h4>
+ <p>The following functions have been replaced by <code>basic_path</code>
+ member functions <code>extension()</code>, <code>stem()</code>, and <code>
+ replace_extension()</code>.</p>
<pre>template <class Path> typename Path::string_type extension(const Path & p);</pre>
<blockquote>
- <p><i>Returns:</i> if <code>p.leaf()</code> contains a <i>dot</i>, returns the
- substring of <code>p.leaf()</code> starting at the rightmost <i>dot</i> and
- ending at the string's end. Otherwise, returns an empty string. </p>
+ <p><i>Returns:</i> if <code>p.filename()</code> contains a <i>dot</i>, returns
+ the substring of <code>p.filename()</code> starting at the rightmost <i>dot</i>
+ and ending at the string's end. Otherwise, returns an empty string. </p>
<p>[<i>Note:<b> </b></i>The <i>dot</i> is included in the return value so that
it is possible to distinguish between no extension and an empty extension. </p>
<p>Implementations are permitted but not required to define additional
@@ -2288,13 +2350,14 @@
</blockquote>
<pre>template <class Path> typename Path::string_type basename(const Path & p);</pre>
<blockquote>
- <p><i>Returns:</i> if <code>p.leaf()</code> contains a <i>dot</i>, returns the
- substring of <code>p.leaf()</code> starting at its beginning and ending at the
- last <i>dot</i> (the <i>dot</i> is not included). Otherwise, returns <code>
- p.leaf()</code>.</p>
+ <p><i>Returns:</i> if <code>p.filename()</code> contains a <i>dot</i>, returns
+ the substring of <code>p.filename()</code> starting at its beginning and
+ ending at the last <i>dot</i> (the <i>dot</i> is not included). Otherwise,
+ returns <code>
+ p.filename()</code>.</p>
</blockquote>
<pre>template <class Path>
- Path replace_extension(const Path & p, const typename Path::string_type & new_extension);</pre>
+ Path change_extension(const Path & p, const typename Path::string_type & new_extension);</pre>
<blockquote>
<p><i>Postcondition:</i> <code>basename(<i>return_value</i>) == basename(p) &&
extension(<i>return_value</i>) == new_extension</code> </p>
@@ -2302,33 +2365,9 @@
that <code>new_extension</code> should include <i>dot</i> to achieve
reasonable results. <i>-- end note</i>]</p>
</blockquote>
-<h3><a name="header-cerrno">Additions</a> to header <code><cerrno></code></h3>
-<p>The header <cerrno> shall include an additional symbolic constant macro for
-each of the values returned by the to_errno
-function. The macro names shall be as defined in <i>POSIX</i>
-<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/errno.h.html">
-errno.h</a>, with the additions below.</p>
-<blockquote>
-<p><i><span style="background-color: #E0E0E0">This codifies existing practice.
-The required names are only a sub-set of those defined by POSIX, and are usually already
-supplied in <errno.h> (as wrapped by <cerrno>) as shipped with POSIX and Windows compilers.
-These implementations require no changes to their underlying C headers to conform with the above
-requirement.</span></i></p>
-<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="33%">
- <tr>
- <td width="18%" align="center"><i><b>Name</b></i></td>
- <td width="82%" align="center"><i><b>Meaning</b></i></td>
- </tr>
- <tr>
- <td width="18%"><code>EBADHANDLE</code></td>
- <td width="82%">Bad operating system handle.</td>
- </tr>
- <tr>
- <td width="18%"><code>EOTHER</code></td>
- <td width="82%">Other error.</td>
+ </td>
</tr>
</table>
-</blockquote>
<h3><a name="header-fstream">Additions</a> to header <code><fstream></code></h3>
<blockquote>
<p><span style="background-color: #E0E0E0; font-style:italic">These additions have been carefully
@@ -2361,14 +2400,14 @@
sentence:</i></span></p>
<blockquote>
<p><span style="background-color: #FFFFFF">It then opens a file, if possible,
-whose name is the NTBS s (as if by calling <code>std::fopen(s ,<i>modstr</i>
+whose name is the NTBS s (âas ifâ by calling <code>std::fopen(s ,<i>modstr</i>
))</code>.</span></p>
</blockquote>
<p><span style="background-color: #FFFFFF"><i>with:</i></span></p>
<blockquote>
<p><span style="background-color: #FFFFFF">It then opens, if possible, the file
that
-<code>p</code> or <code>path(s)</code> resolves to, as if by calling <code>std::fopen()</code> with a
+<code>p</code> or <code>path(s)</code> resolves to, âas ifâ by calling <code>std::fopen()</code> with a
second argument of <i>modstr</i>.</span></p>
</blockquote>
<p><span style="background-color: #FFFFFF"><i>In 27.8.1.5 Class template
@@ -2487,8 +2526,8 @@
<td width="48"><b><code>root_<br>name()</code></b></td>
<td width="88"><b><code>root_<br>directory()</code></b></td>
<td width="96"><b><code>relative_<br>path()<br>.string()</code></b></td>
-<td width="72"><b><code>branch_<br>path()<br>.string()</code></b></td>
-<td width="72"><b><code>leaf()</code></b></td>
+<td width="72"><b><code>parent_<br>path()<br>.string()</code></b></td>
+<td width="72"><b><code>filename()</code></b></td>
</tr>
<tr>
<td width="112"><code>""</code></td>
@@ -2992,29 +3031,6 @@
classes, overriding the constructors and opens taking pathname arguments, and
providing the additional overloads. In Lillehammer LWG members indicated lack of
support for this alternative, feeling that costs outweigh benefits.</span></p>
-<h2><a name="Issues">Issues</a></h2>
-<h3>1. Return type of certain basic_path members returning strings. [Howard
-Hinnant]</h3>
-<p>For member functions described as returning "<code>const string_type</code>"
-or "<code>const external_string_type</code>", implementations are permitted to
-return "<code>const string_type&</code>" or "<code>const
-external_string_type&</code>" respectively.</p>
-<p>This allows implementations to avoid unnecessary copies. Return-by-value is
-specified as
-<code>const</code> to ensure programs won't break if moved to a
-return-by-reference implementation.</p>
-<p>For example, the Boost implementation keeps the internal representation of a
-pathname in the portable format, so string() returns by reference and is inlined:</p>
-<blockquote>
- <pre>const string_type & string() const { return m_path; }</pre>
-</blockquote>
-<p>Howard Hinnant comments: This may inhibit optimization if rvalue reference is
-accepted. Const-qualified return types can't be moved from. I'd
-rather see either the return type specified as
-<code>const string_type&</code> or <code>string_type</code>.</p>
-<p>Beman Dawes comments: I can't make up my mind. Removing the const will bite
-users, but not very often. OTOH, excessive copying is a real concern, and if
-move semantics can alleviate that, I'm all for it. What does the LWG think?</p>
<h2><a name="Acknowledgements">Acknowledgements</a></h2>
<p>This Filesystem Library is dedicated to my wife, Sonda, who provided the
support necessary to see both a trial implementation and the proposal itself
@@ -3024,8 +3040,7 @@
Boost Filesystem Library. See
<a href="http://www.boost.org/libs/filesystem/doc/index.htm#Acknowledgements">
http://www.boost.org/libs/filesystem/doc/index.htm#Acknowledgements>.</p>
-<p>Dietmar Kühl contributed the original Boost Filesystem Library
-directory_iterator design. Peter Dimov, Walter Landry, Rob Stewart, and Thomas
+<p>Dietmar Kuehl contributed the original Boost Filesystem Library directory_iterator design. Peter Dimov, Walter Landry, Rob Stewart, and Thomas
Witt were particularly helpful in refining the library.</p>
<p>The create_directories, extension, basename, and replace_extension functions
were developed by Vladimir Prus.</p>
@@ -3037,7 +3052,7 @@
<tr>
<td width="16%" valign="top">[<a name="ISO_POSIX">ISO-POSIX</a>]</td>
<td width="84%">ISO/IEC 9945:2003, IEEE Std 1003.1-2001, and The Open Group
- Base Specifications, Issue 6. Also known as The Single Unix<font face="Times New Roman">®
+ Base Specifications, Issue 6. Also known as The Single Unix<font face="Times New Roman">®
Specification, Version 3. Available from each of the organizations involved
in its creation. For example, read online or download from
<a href="http://www.unix.org/single_unix_specification/">
@@ -3057,7 +3072,7 @@
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
<p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->18 March 2008<!--webbot bot="Timestamp" endspan i-checksum="27357" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->06 July 2008<!--webbot bot="Timestamp" endspan i-checksum="18830" --></p>
</body>
Modified: branches/release/libs/filesystem/example/mbcopy.cpp
==============================================================================
--- branches/release/libs/filesystem/example/mbcopy.cpp (original)
+++ branches/release/libs/filesystem/example/mbcopy.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -72,9 +72,9 @@
for ( fs::wdirectory_iterator it( L"." );
it != fs::wdirectory_iterator(); ++it )
{
- if ( fs::is_regular(it->status()) )
+ if ( fs::is_regular_file(it->status()) )
{
- copy_file( *it, target_dir / it->leaf() );
+ copy_file( *it, target_dir / it->filename() );
}
}
Modified: branches/release/libs/filesystem/example/mbpath.cpp
==============================================================================
--- branches/release/libs/filesystem/example/mbpath.cpp (original)
+++ branches/release/libs/filesystem/example/mbpath.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -1,6 +1,6 @@
// Boost.Filesystem mbpath.hpp ---------------------------------------------//
-// © Copyright Beman Dawes 2005
+// (c) Copyright Beman Dawes 2005
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -14,7 +14,7 @@
# endif
#include "mbpath.hpp"
-#include <cerrno>
+#include <boost/system/system_error.hpp>
#include <boost/scoped_array.hpp>
namespace fs = boost::filesystem;
Modified: branches/release/libs/filesystem/example/simple_ls.cpp
==============================================================================
--- branches/release/libs/filesystem/example/simple_ls.cpp (original)
+++ branches/release/libs/filesystem/example/simple_ls.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -51,24 +51,24 @@
if ( fs::is_directory( dir_itr->status() ) )
{
++dir_count;
- std::cout << dir_itr->leaf() << " [directory]\n";
+ std::cout << dir_itr->filename() << " [directory]\n";
}
- else if ( fs::is_regular( dir_itr->status() ) )
+ else if ( fs::is_regular_file( dir_itr->status() ) )
{
++file_count;
- std::cout << dir_itr->leaf() << "\n";
+ std::cout << dir_itr->filename() << "\n";
}
else
{
++other_count;
- std::cout << dir_itr->leaf() << " [other]\n";
+ std::cout << dir_itr->filename() << " [other]\n";
}
}
catch ( const std::exception & ex )
{
++err_count;
- std::cout << dir_itr->leaf() << " " << ex.what() << std::endl;
+ std::cout << dir_itr->filename() << " " << ex.what() << std::endl;
}
}
std::cout << "\n" << file_count << " files\n"
Deleted: branches/release/libs/filesystem/src/exception.cpp
==============================================================================
--- branches/release/libs/filesystem/src/exception.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
+++ (empty file)
@@ -1,166 +0,0 @@
-// Exception implementation file -------------------------------------------//
-
-// Copyright 2002 Beman Dawes
-// Copyright 2001 Dietmar Kuehl
-// Use, modification, and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
-// at http://www.boost.org/LICENSE_1_0.txt)
-
-// See library home page at http://www.boost.org/libs/filesystem
-
-//----------------------------------------------------------------------------//
-
-// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows
-// the library is being built (possibly exporting rather than importing code)
-#define BOOST_FILESYSTEM_SOURCE
-
-#include <boost/filesystem/config.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/filesystem/cerrno.hpp>
-
-namespace fs = boost::filesystem;
-
-#include <cstring> // SGI MIPSpro compilers need this
-
-# ifdef BOOST_NO_STDC_NAMESPACE
- namespace std { using ::strerror; }
-# endif
-
-
-# if defined( BOOST_WINDOWS_API )
-# include "windows.h"
-# endif
-
-//----------------------------------------------------------------------------//
-
-namespace
-{
-#ifdef BOOST_WINDOWS_API
- struct ec_xlate { fs::system_error_type sys_ec; fs::errno_type ec; };
- const ec_xlate ec_table[] =
- {
- // see WinError.h comments for descriptions of errors
-
- // most common errors first to speed sequential search
- { ERROR_FILE_NOT_FOUND, ENOENT },
- { ERROR_PATH_NOT_FOUND, ENOENT },
-
- // alphabetical for easy maintenance
- { 0, 0 }, // no error
- { ERROR_ACCESS_DENIED, EACCES },
- { ERROR_ALREADY_EXISTS, EEXIST },
- { ERROR_BAD_UNIT, ENODEV },
- { ERROR_BUFFER_OVERFLOW, ENAMETOOLONG },
- { ERROR_BUSY, EBUSY },
- { ERROR_BUSY_DRIVE, EBUSY },
- { ERROR_CANNOT_MAKE, EACCES },
- { ERROR_CANTOPEN, EIO },
- { ERROR_CANTREAD, EIO },
- { ERROR_CANTWRITE, EIO },
- { ERROR_CURRENT_DIRECTORY, EACCES },
- { ERROR_DEV_NOT_EXIST, ENODEV },
- { ERROR_DEVICE_IN_USE, EBUSY },
- { ERROR_DIR_NOT_EMPTY, ENOTEMPTY },
- { ERROR_DIRECTORY, EINVAL }, // WinError.h: "The directory name is invalid"
- { ERROR_DISK_FULL, ENOSPC },
- { ERROR_FILE_EXISTS, EEXIST },
- { ERROR_HANDLE_DISK_FULL, ENOSPC },
- { ERROR_INVALID_ACCESS, EACCES },
- { ERROR_INVALID_DRIVE, ENODEV },
- { ERROR_INVALID_FUNCTION, ENOSYS },
- { ERROR_INVALID_HANDLE, EBADHANDLE },
- { ERROR_INVALID_NAME, EINVAL },
- { ERROR_LOCK_VIOLATION, EACCES },
- { ERROR_LOCKED, EACCES },
- { ERROR_NOACCESS, EACCES },
- { ERROR_NOT_ENOUGH_MEMORY, ENOMEM },
- { ERROR_NOT_READY, EAGAIN },
- { ERROR_NOT_SAME_DEVICE, EXDEV },
- { ERROR_OPEN_FAILED, EIO },
- { ERROR_OPEN_FILES, EBUSY },
- { ERROR_OUTOFMEMORY, ENOMEM },
- { ERROR_READ_FAULT, EIO },
- { ERROR_SEEK, EIO },
- { ERROR_SHARING_VIOLATION, EACCES },
- { ERROR_TOO_MANY_OPEN_FILES, ENFILE },
- { ERROR_WRITE_FAULT, EIO },
- { ERROR_WRITE_PROTECT, EROFS },
- { 0,EOTHER }
- };
-#endif
-
-} // unnamed namespace
-
-namespace boost
-{
- namespace filesystem
- {
-# ifdef BOOST_WINDOWS_API
-
- BOOST_FILESYSTEM_DECL
- errno_type lookup_errno( system_error_type sys_err_code )
- {
- for ( const ec_xlate * cur = &ec_table[0];
- cur != ec_table
- + sizeof(ec_table)/sizeof(ec_xlate); ++cur )
- {
- if ( sys_err_code == cur->sys_ec ) return cur->ec;
- }
- return EOTHER;
- }
-
- BOOST_FILESYSTEM_DECL void
- system_message( system_error_type sys_err_code, std::string & target )
- {
- LPVOID lpMsgBuf;
- ::FormatMessageA(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- sys_err_code,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPSTR) &lpMsgBuf,
- 0,
- NULL
- );
- target += static_cast<LPCSTR>(lpMsgBuf);
- ::LocalFree( lpMsgBuf ); // free the buffer
- while ( target.size()
- && (target[target.size()-1] == '\n' || target[target.size()-1] == '\r') )
- target.erase( target.size()-1 );
- }
-
-# ifndef BOOST_FILESYSTEM_NARROW_ONLY
- BOOST_FILESYSTEM_DECL void
- system_message( system_error_type sys_err_code, std::wstring & target )
- {
- LPVOID lpMsgBuf;
- ::FormatMessageW(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- sys_err_code,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPWSTR) &lpMsgBuf,
- 0,
- NULL
- );
- target += static_cast<LPCWSTR>(lpMsgBuf);
- ::LocalFree( lpMsgBuf ); // free the buffer
- while ( target.size()
- && (target[target.size()-1] == L'\n' || target[target.size()-1] == L'\r') )
- target.erase( target.size()-1 );
- }
-# endif
-# else
- void
- system_message( system_error_type sys_err_code, std::string & target )
- {
- target += std::strerror( sys_err_code );
- }
-# endif
-
- } // namespace filesystem
-} // namespace boost
Modified: branches/release/libs/filesystem/src/operations.cpp
==============================================================================
--- branches/release/libs/filesystem/src/operations.cpp (original)
+++ branches/release/libs/filesystem/src/operations.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -110,6 +110,8 @@
namespace
{
+ const error_code ok;
+
const fs::directory_iterator end_itr;
bool is_empty_directory( const std::string & dir_path )
{
@@ -200,19 +202,19 @@
|| (ec.value() == ERROR_BAD_PATHNAME) // "//nosuch" on Win64
|| (ec.value() == ERROR_BAD_NETPATH)) // "//nosuch" on Win32
{
- ec = error_code(); // these are not considered errors;
+ ec = ok; // these are not considered errors;
// the status is considered not found
return fs::file_status( fs::file_not_found );
}
else if ((ec.value() == ERROR_SHARING_VIOLATION))
{
- ec = error_code(); // these are not considered errors;
+ ec = ok; // these are not considered errors;
// the file exists but the type is not known
return fs::file_status( fs::type_unknown );
}
return fs::file_status( fs::status_unknown );
}
- ec = error_code();;
+ ec = ok;;
return (attr & FILE_ATTRIBUTE_DIRECTORY)
? fs::file_status( fs::directory_file )
: fs::file_status( fs::regular_file );
@@ -229,7 +231,7 @@
WIN32_FILE_ATTRIBUTE_DATA fad;
if ( get_file_attributes_ex( ph.c_str(), fad ) == 0 )
return std::make_pair( error_code( ::GetLastError(), system_category ), false );
- return std::make_pair( error_code(),
+ return std::make_pair( ok,
( fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
? is_empty_directory( ph )
:( !fad.nFileSizeHigh && !fad.nFileSizeLow ) );
@@ -295,7 +297,7 @@
{
if ( p1.handle != INVALID_HANDLE_VALUE
|| p2.handle != INVALID_HANDLE_VALUE )
- { return std::make_pair( error_code(), false ); }
+ { return std::make_pair( ok, false ); }
assert( p1.handle == INVALID_HANDLE_VALUE
&& p2.handle == INVALID_HANDLE_VALUE );
{ return std::make_pair( error_code( error1, system_category), false ); }
@@ -309,7 +311,7 @@
// In theory, volume serial numbers are sufficient to distinguish between
// devices, but in practice VSN's are sometimes duplicated, so last write
// time and file size are also checked.
- return std::make_pair( error_code(),
+ return std::make_pair( ok,
info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber
&& info1.nFileIndexHigh == info2.nFileIndexHigh
&& info1.nFileIndexLow == info2.nFileIndexLow
@@ -331,7 +333,7 @@
return std::make_pair( error_code( ::GetLastError(), system_category ), 0 );
if ( (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !=0 )
return std::make_pair( error_code( ERROR_FILE_NOT_FOUND, system_category), 0 );
- return std::make_pair( error_code(),
+ return std::make_pair( ok,
(static_cast<boost::uintmax_t>(fad.nFileSizeHigh)
<< (sizeof(fad.nFileSizeLow)*8))
+ fad.nFileSizeLow );
@@ -349,7 +351,7 @@
boost::filesystem::detail::space_pair result;
if ( get_free_disk_space( ph, &avail, &total, &free ) )
{
- result.first = error_code();
+ result.first = ok;
result.second.capacity
= (static_cast<boost::uintmax_t>(total.HighPart) << 32)
+ total.LowPart;
@@ -385,7 +387,7 @@
if ( get_current_directory( sz, buf.get() ) == 0 )
return error_code( ::GetLastError(), system_category );
ph = buf.get();
- return error_code();
+ return ok;
}
inline bool set_current_directory( const char * buf )
@@ -426,11 +428,11 @@
== 0 ) return error_code( ::GetLastError(), system_category );
big_buf[len] = '\0';
target = big_buf.get();
- return error_code();
+ return ok;
}
buf[len] = '\0';
target = buf;
- return error_code();
+ return ok;
}
template<class String>
@@ -517,9 +519,14 @@
error_code
remove_template( const String & ph )
{
+ // TODO: test this code in the presence of Vista symlinks,
+ // including dangling, self-referal, and cyclic symlinks
error_code ec;
fs::file_status sf( fs::detail::status_api( ph, ec ) );
- if ( ec ) return ec;
+ if ( ec )
+ return ec;
+ if ( sf.type() == fs::file_not_found )
+ return ok;
if ( fs::is_directory( sf ) )
{
if ( !remove_directory( ph ) )
@@ -529,7 +536,7 @@
{
if ( !delete_file( ph ) ) return error_code(::GetLastError(), system_category);
}
- return error_code();
+ return ok;
}
inline bool create_directory( const std::string & dir )
@@ -545,7 +552,7 @@
// an error here may simply mean the postcondition is already met
if ( error.value() == ERROR_ALREADY_EXISTS
&& fs::is_directory( fs::detail::status_api( dir_ph, dummy ) ) )
- return std::make_pair( error_code(), false );
+ return std::make_pair( ok, false );
return std::make_pair( error, false );
}
@@ -566,6 +573,24 @@
}
#endif
+#else // BOOST_POSIX_API
+
+ int posix_remove( const char * p )
+ {
+# if defined(__QNXNTO__) || (defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)))
+ // Some Metrowerks C library versions fail on directories because of a
+ // known Metrowerks coding error in ::remove. Workaround is to call
+ // rmdir() or unlink() as indicated.
+ // Same bug also reported for QNX, with the same fix.
+ int err = ::unlink( p );
+ if ( err != EPERM )
+ return err;
+ return ::rmdir( p )
+# else
+ return std::remove( p );
+# endif
+ }
+
#endif
} // unnamed namespace
@@ -575,6 +600,7 @@
{
namespace detail
{
+ BOOST_FILESYSTEM_DECL system::error_code throws;
// free functions ----------------------------------------------------------//
@@ -763,7 +789,7 @@
if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{ sf.type( directory_file ); symlink_sf.type( directory_file ); }
else { sf.type( regular_file ); symlink_sf.type( regular_file ); }
- return error_code();
+ return ok;
}
BOOST_FILESYSTEM_DECL error_code
@@ -781,7 +807,7 @@
if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{ sf.type( directory_file ); symlink_sf.type( directory_file ); }
else { sf.type( regular_file ); symlink_sf.type( regular_file ); }
- return error_code();
+ return ok;
}
# endif // ifndef BOOST_FILESYSTEM_NARROW_ONLY
@@ -889,7 +915,7 @@
if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{ sf.type( directory_file ); symlink_sf.type( directory_file ); }
else { sf.type( regular_file ); symlink_sf.type( regular_file ); }
- return error_code();
+ return ok;
}
BOOST_FILESYSTEM_DECL error_code
@@ -901,7 +927,7 @@
handle = 0;
return error_code( ok ? 0 : ::GetLastError(), system_category );
}
- return error_code();
+ return ok;
}
BOOST_FILESYSTEM_DECL error_code
@@ -919,7 +945,7 @@
if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{ sf.type( directory_file ); symlink_sf.type( directory_file ); }
else { sf.type( regular_file ); symlink_sf.type( regular_file ); }
- return error_code();
+ return ok;
}
# else // BOOST_POSIX_API
@@ -932,13 +958,13 @@
{
if ( errno == ENOENT || errno == ENOTDIR )
{
- ec = error_code();
+ ec = ok;
return fs::file_status( fs::file_not_found );
}
ec = error_code( errno, system_category );
return fs::file_status( fs::status_unknown );
}
- ec = error_code();
+ ec = ok;
if ( S_ISDIR( path_stat.st_mode ) )
return fs::file_status( fs::directory_file );
if ( S_ISREG( path_stat.st_mode ) )
@@ -962,13 +988,13 @@
{
if ( errno == ENOENT || errno == ENOTDIR )
{
- ec = error_code();
+ ec = ok;
return fs::file_status( fs::file_not_found );
}
ec = error_code( errno, system_category );
return fs::file_status( fs::status_unknown );
}
- ec = error_code();
+ ec = ok;
if ( S_ISREG( path_stat.st_mode ) )
return fs::file_status( fs::regular_file );
if ( S_ISDIR( path_stat.st_mode ) )
@@ -1001,7 +1027,7 @@
struct stat path_stat;
if ( (::stat( ph.c_str(), &path_stat )) != 0 )
return std::make_pair( error_code( errno, system_category ), false );
- return std::make_pair( error_code(), S_ISDIR( path_stat.st_mode )
+ return std::make_pair( ok, S_ISDIR( path_stat.st_mode )
? is_empty_directory( ph )
: path_stat.st_size == 0 );
}
@@ -1016,7 +1042,7 @@
if ( e1 != 0 || e2 != 0 )
return std::make_pair( error_code( e1 != 0 && e2 != 0 ? errno : 0, system_category ), false );
// at this point, both stats are known to be valid
- return std::make_pair( error_code(),
+ return std::make_pair( ok,
s1.st_dev == s2.st_dev
&& s1.st_ino == s2.st_ino
// According to the POSIX stat specs, "The st_ino and st_dev fields
@@ -1034,7 +1060,7 @@
return std::make_pair( error_code( errno, system_category ), 0 );
if ( !S_ISREG( path_stat.st_mode ) )
return std::make_pair( error_code( EPERM, system_category ), 0 );
- return std::make_pair( error_code(),
+ return std::make_pair( ok,
static_cast<boost::uintmax_t>(path_stat.st_size) );
}
@@ -1051,7 +1077,7 @@
}
else
{
- result.first = error_code();
+ result.first = ok;
result.second.capacity
= static_cast<boost::uintmax_t>(vfs.f_blocks) * BOOST_STATVFS_F_FRSIZE;
result.second.free
@@ -1068,7 +1094,7 @@
struct stat path_stat;
if ( ::stat( ph.c_str(), &path_stat ) != 0 )
return std::make_pair( error_code( errno, system_category ), 0 );
- return std::make_pair( error_code(), path_stat.st_mtime );
+ return std::make_pair( ok, path_stat.st_mtime );
}
BOOST_FILESYSTEM_DECL error_code
@@ -1105,7 +1131,7 @@
break;
}
}
- return error_code();
+ return ok;
}
BOOST_FILESYSTEM_DECL error_code
@@ -1119,13 +1145,13 @@
create_directory_api( const std::string & ph )
{
if ( ::mkdir( ph.c_str(), S_IRWXU|S_IRWXG|S_IRWXO ) == 0 )
- { return std::make_pair( error_code(), true ); }
+ { return std::make_pair( ok, true ); }
int ec=errno;
error_code dummy;
if ( ec != EEXIST
|| !fs::is_directory( status_api( ph, dummy ) ) )
{ return std::make_pair( error_code( ec, system_category ), false ); }
- return std::make_pair( error_code(), false );
+ return std::make_pair( ok, false );
}
BOOST_FILESYSTEM_DECL error_code
@@ -1147,28 +1173,19 @@
BOOST_FILESYSTEM_DECL error_code
remove_api( const std::string & ph )
{
-# if defined(__QNXNTO__) || (defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)))
- // Some Metrowerks C library versions fail on directories because of a
- // known Metrowerks coding error in ::remove. Workaround is to call
- // rmdir() or unlink() as indicated.
- // Same bug also reported for QNX, with the same fix.
- if ( (is_directory( ph )
- ? ::rmdir( ph.c_str() )
- : ::unlink( ph.c_str() )) != 0 )
-# else
- // note that the POSIX behavior for symbolic links is what we want;
- // the link rather than what it points to is deleted
- if ( std::remove( ph.c_str() ) != 0 )
-# endif
- {
- int error = errno;
- // POSIX says "If the directory is not an empty directory, rmdir()
- // shall fail and set errno to EEXIST or ENOTEMPTY."
- // Linux uses ENOTEMPTY, Solaris uses EEXIST.
- if ( error == EEXIST ) error = ENOTEMPTY;
- return error_code( error, system_category );
- }
- return error_code();
+ if ( posix_remove( ph.c_str() ) == 0 )
+ return ok;
+ int error = errno;
+ // POSIX says "If the directory is not an empty directory, rmdir()
+ // shall fail and set errno to EEXIST or ENOTEMPTY."
+ // Linux uses ENOTEMPTY, Solaris uses EEXIST.
+ if ( error == EEXIST ) error = ENOTEMPTY;
+
+ error_code ec;
+
+ // ignore errors if post-condition satisfied
+ return status_api(ph, ec).type() == file_not_found
+ ? ok : error_code( error, system_category ) ;
}
BOOST_FILESYSTEM_DECL error_code
@@ -1249,7 +1266,7 @@
else max = static_cast<std::size_t>( tmp + 1 ); // relative root
}
result = max;
- return error_code();
+ return ok;
}
BOOST_FILESYSTEM_DECL error_code
@@ -1268,7 +1285,7 @@
dirent de;
buffer = std::malloc( (sizeof(dirent) - sizeof(de.d_name))
+ path_size + 1 ); // + 1 for "/0"
- return error_code();
+ return ok;
}
BOOST_FILESYSTEM_DECL error_code
@@ -1276,7 +1293,7 @@
{
std::free( buffer );
buffer = 0;
- if ( handle == 0 ) return error_code();
+ if ( handle == 0 ) return ok;
DIR * h( static_cast<DIR*>(handle) );
handle = 0;
return error_code( ::closedir( h ) == 0 ? 0 : errno, system_category );
@@ -1339,7 +1356,7 @@
# else
sf = symlink_sf = fs::file_status( fs::status_unknown );
# endif
- return error_code();
+ return ok;
}
# endif
Modified: branches/release/libs/filesystem/src/path.cpp
==============================================================================
--- branches/release/libs/filesystem/src/path.cpp (original)
+++ branches/release/libs/filesystem/src/path.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -24,6 +24,8 @@
#include <boost/cerrno.hpp>
#include <boost/system/error_code.hpp>
+#include <cwchar> // for std::mbstate_t
+
namespace
{
// std::locale construction can throw (if LC_MESSAGES is wrong, for example),
Modified: branches/release/libs/filesystem/src/utf8_codecvt_facet.hpp
==============================================================================
--- branches/release/libs/filesystem/src/utf8_codecvt_facet.hpp (original)
+++ branches/release/libs/filesystem/src/utf8_codecvt_facet.hpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -1,4 +1,4 @@
-// Copyright © 2001 Ronald Garcia, Indiana University (garcia_at_[hidden])
+// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia_at_[hidden])
// Andrew Lumsdaine, Indiana University (lums_at_[hidden]).
// Distributed under the Boost Software License, Version 1.0.
Modified: branches/release/libs/filesystem/test/convenience_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/convenience_test.cpp (original)
+++ branches/release/libs/filesystem/test/convenience_test.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -8,12 +8,7 @@
// See library home page at http://www.boost.org/libs/filesystem
-// VC++ 8.0 warns on various less-than-safe practices.
-// See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
-// But at least in VC++ 8.0 betas, their own libraries use the problem
-// practices. So turn off the warnings.
-#define _CRT_SECURE_NO_DEPRECATE
-#define _SCL_SECURE_NO_DEPRECATE
+#include <boost/config/warning_disable.hpp>
#include <boost/filesystem/convenience.hpp>
namespace fs = boost::filesystem;
Modified: branches/release/libs/filesystem/test/equivalent.cpp
==============================================================================
--- branches/release/libs/filesystem/test/equivalent.cpp (original)
+++ branches/release/libs/filesystem/test/equivalent.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -1,6 +1,6 @@
// equivalent program -------------------------------------------------------//
-// Copyright © 2004 Beman Dawes
+// Copyright (c) 2004 Beman Dawes
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
Modified: branches/release/libs/filesystem/test/fstream_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/fstream_test.cpp (original)
+++ branches/release/libs/filesystem/test/fstream_test.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -7,12 +7,7 @@
// See library home page at http://www.boost.org/libs/filesystem
-// VC++ 8.0 warns on various less-than-safe practices.
-// See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
-// But at least in VC++ 8.0 betas, their own libraries use the problem
-// practices. So turn off the warnings.
-#define _CRT_SECURE_NO_DEPRECATE
-#define _SCL_SECURE_NO_DEPRECATE
+#include <boost/config/warning_disable.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp>
@@ -73,7 +68,7 @@
}
{
std::cout << " in test 4.1\n";
- fs::ifstream tfs( p / p.leaf() ); // should fail
+ fs::ifstream tfs( p / p.filename() ); // should fail
BOOST_CHECK( !tfs.is_open() );
}
{
Modified: branches/release/libs/filesystem/test/lpath.hpp
==============================================================================
--- branches/release/libs/filesystem/test/lpath.hpp (original)
+++ branches/release/libs/filesystem/test/lpath.hpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -10,6 +10,7 @@
#include <boost/filesystem/path.hpp>
#include <string>
+#include <ios> // for std::streamoff
namespace std
{
Modified: branches/release/libs/filesystem/test/operations_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/operations_test.cpp (original)
+++ branches/release/libs/filesystem/test/operations_test.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -7,12 +7,7 @@
// See library home page at http://www.boost.org/libs/filesystem
-// VC++ 8.0 warns on various less-than-safe practices.
-// See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
-// But at least in VC++ 8.0 betas, their own libraries use the problem
-// practices. So turn off the warnings.
-#define _CRT_SECURE_NO_DEPRECATE
-#define _SCL_SECURE_NO_DEPRECATE
+#include <boost/config/warning_disable.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/convenience.hpp>
@@ -305,20 +300,21 @@
fs::path ng( " no-way, Jose" );
BOOST_CHECK( !fs::exists( ng ) );
BOOST_CHECK( !fs::is_directory( ng ) );
- BOOST_CHECK( !fs::is_regular( ng ) );
+ BOOST_CHECK( !fs::is_regular_file( ng ) );
+ BOOST_CHECK( !fs::is_regular( ng ) ); // verify deprecated name still works
BOOST_CHECK( !fs::is_symlink( ng ) );
fs::file_status stat( fs::status( ng ) );
BOOST_CHECK( fs::status_known( stat ) );
BOOST_CHECK( !fs::exists( stat ) );
BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular( stat ) );
+ BOOST_CHECK( !fs::is_regular_file( stat ) );
BOOST_CHECK( !fs::is_other( stat ) );
BOOST_CHECK( !fs::is_symlink( stat ) );
stat = fs::status( "" );
BOOST_CHECK( fs::status_known( stat ) );
BOOST_CHECK( !fs::exists( stat ) );
BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular( stat ) );
+ BOOST_CHECK( !fs::is_regular_file( stat ) );
BOOST_CHECK( !fs::is_other( stat ) );
BOOST_CHECK( !fs::is_symlink( stat ) );
@@ -392,13 +388,13 @@
BOOST_CHECK( fs::exists( dir ) );
BOOST_CHECK( BOOST_FS_IS_EMPTY( dir ) );
BOOST_CHECK( fs::is_directory( dir ) );
- BOOST_CHECK( !fs::is_regular( dir ) );
+ BOOST_CHECK( !fs::is_regular_file( dir ) );
BOOST_CHECK( !fs::is_other( dir ) );
BOOST_CHECK( !fs::is_symlink( dir ) );
stat = fs::status( dir );
BOOST_CHECK( fs::exists( stat ) );
BOOST_CHECK( fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular( stat ) );
+ BOOST_CHECK( !fs::is_regular_file( stat ) );
BOOST_CHECK( !fs::is_other( stat ) );
BOOST_CHECK( !fs::is_symlink( stat ) );
@@ -481,7 +477,7 @@
BOOST_CHECK( fs::is_directory( dir_itr->status() ) );
BOOST_CHECK( fs::is_directory( fs::symlink_status(*dir_itr) ) );
BOOST_CHECK( fs::is_directory( dir_itr->symlink_status() ) );
- BOOST_CHECK( dir_itr->leaf() == "d1" );
+ BOOST_CHECK( dir_itr->filename() == "d1" );
}
// create a second directory named d2
@@ -496,26 +492,26 @@
fs::directory_iterator dir_itr( dir );
BOOST_CHECK( fs::exists(dir_itr->status()) );
BOOST_CHECK( fs::is_directory(dir_itr->status()) );
- BOOST_CHECK( !fs::is_regular(dir_itr->status()) );
+ BOOST_CHECK( !fs::is_regular_file(dir_itr->status()) );
BOOST_CHECK( !fs::is_other(dir_itr->status()) );
BOOST_CHECK( !fs::is_symlink(dir_itr->status()) );
fs::directory_iterator dir_itr2( dir );
- BOOST_CHECK( dir_itr->leaf() == "d1"
- || dir_itr->leaf() == "d2" );
- BOOST_CHECK( dir_itr2->leaf() == "d1" || dir_itr2->leaf() == "d2" );
- if ( dir_itr->leaf() == "d1" )
- {
- BOOST_CHECK( (++dir_itr)->leaf() == "d2" );
- BOOST_CHECK( dir_itr2->leaf() == "d1" );
- BOOST_CHECK( (++dir_itr2)->leaf() == "d2" );
+ BOOST_CHECK( dir_itr->filename() == "d1"
+ || dir_itr->filename() == "d2" );
+ BOOST_CHECK( dir_itr2->filename() == "d1" || dir_itr2->filename() == "d2" );
+ if ( dir_itr->filename() == "d1" )
+ {
+ BOOST_CHECK( (++dir_itr)->filename() == "d2" );
+ BOOST_CHECK( dir_itr2->filename() == "d1" );
+ BOOST_CHECK( (++dir_itr2)->filename() == "d2" );
}
else
{
- BOOST_CHECK( dir_itr->leaf() == "d2" );
- BOOST_CHECK( (++dir_itr)->leaf() == "d1" );
- BOOST_CHECK( (dir_itr2)->leaf() == "d2" );
- BOOST_CHECK( (++dir_itr2)->leaf() == "d1" );
+ BOOST_CHECK( dir_itr->filename() == "d2" );
+ BOOST_CHECK( (++dir_itr)->filename() == "d1" );
+ BOOST_CHECK( (dir_itr2)->filename() == "d2" );
+ BOOST_CHECK( (++dir_itr2)->filename() == "d1" );
}
BOOST_CHECK( ++dir_itr == fs::directory_iterator() );
BOOST_CHECK( dir_itr2 != fs::directory_iterator() );
@@ -524,21 +520,21 @@
{ // *i++ must work to meet the standard's InputIterator requirements
fs::directory_iterator dir_itr( dir );
- BOOST_CHECK( dir_itr->leaf() == "d1"
- || dir_itr->leaf() == "d2" );
- if ( dir_itr->leaf() == "d1" )
+ BOOST_CHECK( dir_itr->filename() == "d1"
+ || dir_itr->filename() == "d2" );
+ if ( dir_itr->filename() == "d1" )
{
- BOOST_CHECK( (*dir_itr++).leaf() == "d1" );
- BOOST_CHECK( dir_itr->leaf() == "d2" );
+ BOOST_CHECK( (*dir_itr++).filename() == "d1" );
+ BOOST_CHECK( dir_itr->filename() == "d2" );
}
else
{
// Check C++98 input iterator requirements
- BOOST_CHECK( (*dir_itr++).leaf() == "d2" );
+ BOOST_CHECK( (*dir_itr++).filename() == "d2" );
// input iterator requirements in the current WP would require this check:
- // BOOST_CHECK( implicit_cast<std::string const&>(*dir_itr++).leaf() == "d1" );
+ // BOOST_CHECK( implicit_cast<std::string const&>(*dir_itr++).filename() == "d1" );
- BOOST_CHECK( dir_itr->leaf() == "d1" );
+ BOOST_CHECK( dir_itr->filename() == "d1" );
}
// test case reported in comment to SourceForge bug tracker [937606]
@@ -559,11 +555,11 @@
fs::directory_iterator it( root_name_path );
BOOST_CHECK( it != fs::directory_iterator() );
BOOST_CHECK( fs::exists( *it ) );
- BOOST_CHECK( it->path().branch_path() == root_name_path );
+ BOOST_CHECK( it->path().parent_path() == root_name_path );
bool found(false);
do
{
- if ( it->leaf() == temp_dir_name ) found = true;
+ if ( it->filename() == temp_dir_name ) found = true;
} while ( ++it != fs::directory_iterator() );
BOOST_CHECK( found );
}
@@ -573,7 +569,7 @@
create_file( file_ph, "" );
BOOST_CHECK( fs::exists( file_ph ) );
BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular( file_ph ) );
+ BOOST_CHECK( fs::is_regular_file( file_ph ) );
BOOST_CHECK( BOOST_FS_IS_EMPTY( file_ph ) );
BOOST_CHECK( fs::file_size( file_ph ) == 0 );
bad_create_directory_path = file_ph;
@@ -582,7 +578,7 @@
BOOST_CHECK( fs::status_known( stat ) );
BOOST_CHECK( fs::exists( stat ) );
BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( fs::is_regular( stat ) );
+ BOOST_CHECK( fs::is_regular_file( stat ) );
BOOST_CHECK( !fs::is_other( stat ) );
BOOST_CHECK( !fs::is_symlink( stat ) );
@@ -592,7 +588,7 @@
BOOST_CHECK( fs::exists( file_ph ) );
BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular( file_ph ) );
+ BOOST_CHECK( fs::is_regular_file( file_ph ) );
BOOST_CHECK( fs::file_size( file_ph ) == 7 );
verify_file( file_ph, "foobar1" );
@@ -661,7 +657,7 @@
stat = fs::symlink_status( from_ph );
BOOST_CHECK( fs::exists( stat ) );
BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular( stat ) );
+ BOOST_CHECK( !fs::is_regular_file( stat ) );
BOOST_CHECK( !fs::is_other( stat ) );
BOOST_CHECK( fs::is_symlink( stat ) );
}
@@ -774,18 +770,18 @@
BOOST_CHECK( !fs::exists( d2 / "d20" ) );
BOOST_CHECK( fs::exists( d1 / "f2" ) );
- // remove() tests on file
+ // remove() file
file_ph = dir / "shortlife";
BOOST_CHECK( !fs::exists( file_ph ) );
create_file( file_ph, "" );
BOOST_CHECK( fs::exists( file_ph ) );
BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::remove( file_ph ) );
+ fs::remove( file_ph );
BOOST_CHECK( !fs::exists( file_ph ) );
- BOOST_CHECK( !fs::remove( "no-such-file" ) );
- BOOST_CHECK( !fs::remove( "no-such-directory/no-such-file" ) );
+ fs::remove( "no-such-file" );
+ fs::remove( "no-such-directory/no-such-file" );
- // remove() test on directory
+ // remove() directory
d1 = dir / "shortlife_dir";
BOOST_CHECK( !fs::exists( d1 ) );
fs::create_directory( d1 );
@@ -794,44 +790,68 @@
BOOST_CHECK( BOOST_FS_IS_EMPTY( d1 ) );
bad_remove_dir = dir;
BOOST_CHECK( CHECK_EXCEPTION( bad_remove, ENOTEMPTY ) );
- BOOST_CHECK( fs::remove( d1 ) );
+ fs::remove( d1 );
BOOST_CHECK( !fs::exists( d1 ) );
-// STLport is allergic to std::system, so don't use runtime platform test
-# ifdef BOOST_POSIX
-
- // remove() test on dangling symbolic link
- fs::path link( "dangling_link" );
- fs::remove( link );
- BOOST_CHECK( !fs::is_symlink( link ) );
- BOOST_CHECK( !fs::exists( link ) );
- std::system("ln -s nowhere dangling_link");
- BOOST_CHECK( !fs::exists( link ) );
- BOOST_CHECK( fs::is_symlink( link ) );
- BOOST_CHECK( fs::remove( link ) );
- BOOST_CHECK( !fs::is_symlink( link ) );
-
- // remove() test on symbolic link to a file
- file_ph = "link_target";
- fs::remove( file_ph );
- BOOST_CHECK( !fs::exists( file_ph ) );
- create_file( file_ph, "" );
- BOOST_CHECK( fs::exists( file_ph ) );
- BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular( file_ph ) );
- std::system("ln -s link_target non_dangling_link");
- link = "non_dangling_link";
- BOOST_CHECK( fs::exists( link ) );
- BOOST_CHECK( !fs::is_directory( link ) );
- BOOST_CHECK( fs::is_regular( link ) );
- BOOST_CHECK( fs::is_symlink( link ) );
- BOOST_CHECK( fs::remove( link ) );
- BOOST_CHECK( fs::exists( file_ph ) );
- BOOST_CHECK( !fs::exists( link ) );
- BOOST_CHECK( !fs::is_symlink( link ) );
- BOOST_CHECK( fs::remove( file_ph ) );
- BOOST_CHECK( !fs::exists( file_ph ) );
-# endif
+ if ( create_symlink_ok ) // only if symlinks supported
+ {
+ // remove() dangling symbolic link
+ fs::path link( "dangling_link" );
+ fs::remove( link );
+ BOOST_CHECK( !fs::is_symlink( link ) );
+ BOOST_CHECK( !fs::exists( link ) );
+ fs::create_symlink( "nowhere", link );
+ BOOST_CHECK( !fs::exists( link ) );
+ BOOST_CHECK( fs::is_symlink( link ) );
+ fs::remove( link );
+ BOOST_CHECK( !fs::is_symlink( link ) );
+
+ // remove() self-refering symbolic link
+ link = "link_to_self";
+ fs::remove( link );
+ BOOST_CHECK( !fs::is_symlink( link ) );
+ BOOST_CHECK( !fs::exists( link ) );
+ fs::create_symlink( link, link );
+ fs::remove( link );
+ BOOST_CHECK( !fs::exists( link ) );
+ BOOST_CHECK( !fs::is_symlink( link ) );
+
+ // remove() cyclic symbolic link
+ link = "link_to_a";
+ fs::path link2( "link_to_b" );
+ fs::remove( link );
+ fs::remove( link2 );
+ BOOST_CHECK( !fs::is_symlink( link ) );
+ BOOST_CHECK( !fs::exists( link ) );
+ fs::create_symlink( link, link2 );
+ fs::create_symlink( link2, link );
+ fs::remove( link );
+ fs::remove( link2 );
+ BOOST_CHECK( !fs::exists( link ) );
+ BOOST_CHECK( !fs::exists( link2 ) );
+ BOOST_CHECK( !fs::is_symlink( link ) );
+
+ // remove() symbolic link to file
+ file_ph = "link_target";
+ fs::remove( file_ph );
+ BOOST_CHECK( !fs::exists( file_ph ) );
+ create_file( file_ph, "" );
+ BOOST_CHECK( fs::exists( file_ph ) );
+ BOOST_CHECK( !fs::is_directory( file_ph ) );
+ BOOST_CHECK( fs::is_regular_file( file_ph ) );
+ link = "non_dangling_link";
+ fs::create_symlink( file_ph, link );
+ BOOST_CHECK( fs::exists( link ) );
+ BOOST_CHECK( !fs::is_directory( link ) );
+ BOOST_CHECK( fs::is_regular_file( link ) );
+ BOOST_CHECK( fs::is_symlink( link ) );
+ fs::remove( link );
+ BOOST_CHECK( fs::exists( file_ph ) );
+ BOOST_CHECK( !fs::exists( link ) );
+ BOOST_CHECK( !fs::is_symlink( link ) );
+ fs::remove( file_ph );
+ BOOST_CHECK( !fs::exists( file_ph ) );
+ }
// write time tests
@@ -839,7 +859,7 @@
create_file( file_ph, "foobar2" );
BOOST_CHECK( fs::exists( file_ph ) );
BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular( file_ph ) );
+ BOOST_CHECK( fs::is_regular_file( file_ph ) );
BOOST_CHECK( fs::file_size( file_ph ) == 7 );
verify_file( file_ph, "foobar2" );
Modified: branches/release/libs/filesystem/test/path_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/path_test.cpp (original)
+++ branches/release/libs/filesystem/test/path_test.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -1,12 +1,18 @@
// path_test program -------------------------------------------------------//
-// Copyright Beman Dawes 2002.
+// Copyright Beman Dawes 2002
+// Copyright Vladimir Prus 2002
+
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See library home page at http://www.boost.org/libs/filesystem
+// basic_path's stem(), extension(), and replace_extension() tests are based
+// on basename(), extension(), and change_extension() tests from the original
+// convenience_test.cpp by Vladimir Prus.
+
#include <boost/filesystem/operations.hpp>
#include <boost/utility.hpp>
#include <iostream>
@@ -248,6 +254,18 @@
path p5;
std::string s1( "//:somestring" );
+ // verify deprecated names still available
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+
+ p1.branch_path();
+ p1.leaf();
+ path p_remove_leaf;
+ p_remove_leaf.remove_leaf();
+
+# endif
+
+
# ifndef BOOST_NO_MEMBER_TEMPLATES
// check the path member templates
@@ -290,10 +308,10 @@
BOOST_CHECK( p1 != p4 );
BOOST_CHECK( p1.string() == p2.string() );
BOOST_CHECK( p1.string() == p3.string() );
- BOOST_CHECK( path( "foo" ).leaf() == "foo" );
- BOOST_CHECK( path( "foo" ).branch_path().string() == "" );
- BOOST_CHECK( p1.leaf() == "fum" );
- BOOST_CHECK( p1.branch_path().string() == "fe/fi/fo" );
+ BOOST_CHECK( path( "foo" ).filename() == "foo" );
+ BOOST_CHECK( path( "foo" ).parent_path().string() == "" );
+ BOOST_CHECK( p1.filename() == "fum" );
+ BOOST_CHECK( p1.parent_path().string() == "fe/fi/fo" );
BOOST_CHECK( path( "" ).empty() == true );
BOOST_CHECK( path( "foo" ).empty() == false );
@@ -336,7 +354,7 @@
PATH_CHECK( "foo/bar", "foo/bar" );
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").leaf(), "foo/bar" ); // const std::string & arg
+ PATH_CHECK( path("foo") / path("woo/bar").filename(), "foo/bar" ); // const std::string & arg
PATH_CHECK( "foo" / path("bar"), "foo/bar" );
PATH_CHECK( "a/b", "a/b" ); // probe for length effects
@@ -616,8 +634,8 @@
p = "";
BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.branch_path().string() == "" );
- BOOST_CHECK( p.leaf() == "" );
+ BOOST_CHECK( p.parent_path().string() == "" );
+ BOOST_CHECK( p.filename() == "" );
BOOST_CHECK( p.root_name() == "" );
BOOST_CHECK( p.root_directory() == "" );
BOOST_CHECK( p.root_path().string() == "" );
@@ -625,14 +643,14 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( !p.has_leaf() );
- BOOST_CHECK( !p.has_branch_path() );
+ BOOST_CHECK( !p.has_filename() );
+ BOOST_CHECK( !p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = "/";
BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.branch_path().string() == "" );
- BOOST_CHECK( p.leaf() == "/" );
+ BOOST_CHECK( p.parent_path().string() == "" );
+ BOOST_CHECK( p.filename() == "/" );
BOOST_CHECK( p.root_name() == "" );
BOOST_CHECK( p.root_directory() == "/" );
BOOST_CHECK( p.root_path().string() == "/" );
@@ -640,8 +658,8 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( !p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( !p.has_parent_path() );
if ( platform == "POSIX" )
BOOST_CHECK( p.is_complete() );
else
@@ -649,8 +667,8 @@
p = "//";
CHECK_EQUAL( p.relative_path().string(), "" );
- CHECK_EQUAL( p.branch_path().string(), "" );
- CHECK_EQUAL( p.leaf(), "//" );
+ CHECK_EQUAL( p.parent_path().string(), "" );
+ CHECK_EQUAL( p.filename(), "//" );
CHECK_EQUAL( p.root_name(), "//" );
CHECK_EQUAL( p.root_directory(), "" );
CHECK_EQUAL( p.root_path().string(), "//" );
@@ -658,15 +676,15 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( !p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( !p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = "///";
CHECK_EQUAL( p.relative_path().string(), "" );
- CHECK_EQUAL( p.branch_path().string(), "" );
- CHECK_EQUAL( p.leaf(), "/" );
+ CHECK_EQUAL( p.parent_path().string(), "" );
+ CHECK_EQUAL( p.filename(), "/" );
CHECK_EQUAL( p.root_name(), "" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "/" );
@@ -674,8 +692,8 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( !p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( !p.has_parent_path() );
if ( platform == "POSIX" )
BOOST_CHECK( p.is_complete() );
else
@@ -683,8 +701,8 @@
p = ".";
BOOST_CHECK( p.relative_path().string() == "." );
- BOOST_CHECK( p.branch_path().string() == "" );
- BOOST_CHECK( p.leaf() == "." );
+ BOOST_CHECK( p.parent_path().string() == "" );
+ BOOST_CHECK( p.filename() == "." );
BOOST_CHECK( p.root_name() == "" );
BOOST_CHECK( p.root_directory() == "" );
BOOST_CHECK( p.root_path().string() == "" );
@@ -692,14 +710,14 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( !p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( !p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = "..";
BOOST_CHECK( p.relative_path().string() == ".." );
- BOOST_CHECK( p.branch_path().string() == "" );
- BOOST_CHECK( p.leaf() == ".." );
+ BOOST_CHECK( p.parent_path().string() == "" );
+ BOOST_CHECK( p.filename() == ".." );
BOOST_CHECK( p.root_name() == "" );
BOOST_CHECK( p.root_directory() == "" );
BOOST_CHECK( p.root_path().string() == "" );
@@ -707,14 +725,14 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( !p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( !p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = "foo";
BOOST_CHECK( p.relative_path().string() == "foo" );
- BOOST_CHECK( p.branch_path().string() == "" );
- BOOST_CHECK( p.leaf() == "foo" );
+ BOOST_CHECK( p.parent_path().string() == "" );
+ BOOST_CHECK( p.filename() == "foo" );
BOOST_CHECK( p.root_name() == "" );
BOOST_CHECK( p.root_directory() == "" );
BOOST_CHECK( p.root_path().string() == "" );
@@ -722,14 +740,14 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( !p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( !p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = "/foo";
CHECK_EQUAL( p.relative_path().string(), "foo" );
- CHECK_EQUAL( p.branch_path().string(), "/" );
- CHECK_EQUAL( p.leaf(), "foo" );
+ CHECK_EQUAL( p.parent_path().string(), "/" );
+ CHECK_EQUAL( p.filename(), "foo" );
CHECK_EQUAL( p.root_name(), "" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "/" );
@@ -737,8 +755,8 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
if ( platform == "POSIX" )
BOOST_CHECK( p.is_complete() );
else
@@ -746,8 +764,8 @@
p = "/foo/";
CHECK_EQUAL( p.relative_path().string(), "foo/" );
- CHECK_EQUAL( p.branch_path().string(), "/foo" );
- CHECK_EQUAL( p.leaf(), "." );
+ CHECK_EQUAL( p.parent_path().string(), "/foo" );
+ CHECK_EQUAL( p.filename(), "." );
CHECK_EQUAL( p.root_name(), "" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "/" );
@@ -755,8 +773,8 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
if ( platform == "POSIX" )
BOOST_CHECK( p.is_complete() );
else
@@ -764,8 +782,8 @@
p = "///foo";
CHECK_EQUAL( p.relative_path().string(), "foo" );
- CHECK_EQUAL( p.branch_path().string(), "/" );
- CHECK_EQUAL( p.leaf(), "foo" );
+ CHECK_EQUAL( p.parent_path().string(), "/" );
+ CHECK_EQUAL( p.filename(), "foo" );
CHECK_EQUAL( p.root_name(), "" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "/" );
@@ -773,8 +791,8 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
if ( platform == "POSIX" )
BOOST_CHECK( p.is_complete() );
else
@@ -782,8 +800,8 @@
p = "foo/bar";
BOOST_CHECK( p.relative_path().string() == "foo/bar" );
- BOOST_CHECK( p.branch_path().string() == "foo" );
- BOOST_CHECK( p.leaf() == "bar" );
+ BOOST_CHECK( p.parent_path().string() == "foo" );
+ BOOST_CHECK( p.filename() == "bar" );
BOOST_CHECK( p.root_name() == "" );
BOOST_CHECK( p.root_directory() == "" );
BOOST_CHECK( p.root_path().string() == "" );
@@ -791,14 +809,14 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = "../foo";
BOOST_CHECK( p.relative_path().string() == "../foo" );
- BOOST_CHECK( p.branch_path().string() == ".." );
- BOOST_CHECK( p.leaf() == "foo" );
+ BOOST_CHECK( p.parent_path().string() == ".." );
+ BOOST_CHECK( p.filename() == "foo" );
BOOST_CHECK( p.root_name() == "" );
BOOST_CHECK( p.root_directory() == "" );
BOOST_CHECK( p.root_path().string() == "" );
@@ -806,14 +824,14 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = "..///foo";
CHECK_EQUAL( p.relative_path().string(), "..///foo" );
- CHECK_EQUAL( p.branch_path().string(), ".." );
- CHECK_EQUAL( p.leaf(), "foo" );
+ CHECK_EQUAL( p.parent_path().string(), ".." );
+ CHECK_EQUAL( p.filename(), "foo" );
CHECK_EQUAL( p.root_name(), "" );
CHECK_EQUAL( p.root_directory(), "" );
CHECK_EQUAL( p.root_path().string(), "" );
@@ -821,14 +839,14 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = "/foo/bar";
BOOST_CHECK( p.relative_path().string() == "foo/bar" );
- BOOST_CHECK( p.branch_path().string() == "/foo" );
- BOOST_CHECK( p.leaf() == "bar" );
+ BOOST_CHECK( p.parent_path().string() == "/foo" );
+ BOOST_CHECK( p.filename() == "bar" );
BOOST_CHECK( p.root_name() == "" );
BOOST_CHECK( p.root_directory() == "/" );
BOOST_CHECK( p.root_path().string() == "/" );
@@ -836,8 +854,8 @@
BOOST_CHECK( !p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
if ( platform == "POSIX" )
BOOST_CHECK( p.is_complete() );
else
@@ -852,8 +870,8 @@
p = path( "//net" );
CHECK_EQUAL( p.string(), "//net" );
CHECK_EQUAL( p.relative_path().string(), "" );
- CHECK_EQUAL( p.branch_path().string(), "" );
- CHECK_EQUAL( p.leaf(), "//net" );
+ CHECK_EQUAL( p.parent_path().string(), "" );
+ CHECK_EQUAL( p.filename(), "//net" );
CHECK_EQUAL( p.root_name(), "//net" );
CHECK_EQUAL( p.root_directory(), "" );
CHECK_EQUAL( p.root_path().string(), "//net" );
@@ -861,14 +879,14 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( !p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( !p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = path( "//net/" );
BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.branch_path().string() == "//net" );
- BOOST_CHECK( p.leaf() == "/" );
+ BOOST_CHECK( p.parent_path().string() == "//net" );
+ BOOST_CHECK( p.filename() == "/" );
BOOST_CHECK( p.root_name() == "//net" );
BOOST_CHECK( p.root_directory() == "/" );
BOOST_CHECK( p.root_path().string() == "//net/" );
@@ -876,14 +894,14 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( p.is_complete() );
p = path( "//net/foo" );
BOOST_CHECK( p.relative_path().string() == "foo" );
- BOOST_CHECK( p.branch_path().string() == "//net/" );
- BOOST_CHECK( p.leaf() == "foo" );
+ BOOST_CHECK( p.parent_path().string() == "//net/" );
+ BOOST_CHECK( p.filename() == "foo" );
BOOST_CHECK( p.root_name() == "//net" );
BOOST_CHECK( p.root_directory() == "/" );
BOOST_CHECK( p.root_path().string() == "//net/" );
@@ -891,14 +909,14 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( p.is_complete() );
p = path( "//net///foo" );
CHECK_EQUAL( p.relative_path().string(), "foo" );
- CHECK_EQUAL( p.branch_path().string(), "//net/" );
- CHECK_EQUAL( p.leaf(), "foo" );
+ CHECK_EQUAL( p.parent_path().string(), "//net/" );
+ CHECK_EQUAL( p.filename(), "foo" );
CHECK_EQUAL( p.root_name(), "//net" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "//net/" );
@@ -906,8 +924,8 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( p.is_complete() );
if ( platform == "Windows" )
@@ -959,8 +977,8 @@
p = path( "c:" );
BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.branch_path().string() == "" );
- BOOST_CHECK( p.leaf() == "c:" );
+ BOOST_CHECK( p.parent_path().string() == "" );
+ BOOST_CHECK( p.filename() == "c:" );
BOOST_CHECK( p.root_name() == "c:" );
BOOST_CHECK( p.root_directory() == "" );
BOOST_CHECK( p.root_path().string() == "c:" );
@@ -968,14 +986,14 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( !p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( !p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = path( "c:foo" );
BOOST_CHECK( p.relative_path().string() == "foo" );
- BOOST_CHECK( p.branch_path().string() == "c:" );
- BOOST_CHECK( p.leaf() == "foo" );
+ BOOST_CHECK( p.parent_path().string() == "c:" );
+ BOOST_CHECK( p.filename() == "foo" );
BOOST_CHECK( p.root_name() == "c:" );
BOOST_CHECK( p.root_directory() == "" );
BOOST_CHECK( p.root_path().string() == "c:" );
@@ -983,14 +1001,14 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = path( "c:/" );
BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.branch_path().string() == "c:" );
- BOOST_CHECK( p.leaf() == "/" );
+ BOOST_CHECK( p.parent_path().string() == "c:" );
+ BOOST_CHECK( p.filename() == "/" );
BOOST_CHECK( p.root_name() == "c:" );
BOOST_CHECK( p.root_directory() == "/" );
BOOST_CHECK( p.root_path().string() == "c:/" );
@@ -998,14 +1016,14 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( p.is_complete() );
p = path( "c:.." );
BOOST_CHECK( p.relative_path().string() == ".." );
- BOOST_CHECK( p.branch_path().string() == "c:" );
- BOOST_CHECK( p.leaf() == ".." );
+ BOOST_CHECK( p.parent_path().string() == "c:" );
+ BOOST_CHECK( p.filename() == ".." );
BOOST_CHECK( p.root_name() == "c:" );
BOOST_CHECK( p.root_directory() == "" );
BOOST_CHECK( p.root_path().string() == "c:" );
@@ -1013,14 +1031,14 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = path( "c:/foo" );
CHECK_EQUAL( p.relative_path().string(), "foo" );
- CHECK_EQUAL( p.branch_path().string(), "c:/" );
- CHECK_EQUAL( p.leaf(), "foo" );
+ CHECK_EQUAL( p.parent_path().string(), "c:/" );
+ CHECK_EQUAL( p.filename(), "foo" );
CHECK_EQUAL( p.root_name(), "c:" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "c:/" );
@@ -1028,14 +1046,14 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( p.is_complete() );
p = path( "c://foo" );
CHECK_EQUAL( p.relative_path().string(), "foo" );
- CHECK_EQUAL( p.branch_path().string(), "c:/" );
- CHECK_EQUAL( p.leaf(), "foo" );
+ CHECK_EQUAL( p.parent_path().string(), "c:/" );
+ CHECK_EQUAL( p.filename(), "foo" );
CHECK_EQUAL( p.root_name(), "c:" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "c:/" );
@@ -1043,14 +1061,14 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( p.is_complete() );
p = path( "c:\\foo\\bar" );
CHECK_EQUAL( p.relative_path().string(), "foo/bar" );
- CHECK_EQUAL( p.branch_path().string(), "c:/foo" );
- CHECK_EQUAL( p.leaf(), "bar" );
+ CHECK_EQUAL( p.parent_path().string(), "c:/foo" );
+ CHECK_EQUAL( p.filename(), "bar" );
CHECK_EQUAL( p.root_name(), "c:" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "c:/" );
@@ -1058,14 +1076,14 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( p.is_complete() );
p = path( "prn:" );
BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.branch_path().string() == "" );
- BOOST_CHECK( p.leaf() == "prn:" );
+ BOOST_CHECK( p.parent_path().string() == "" );
+ BOOST_CHECK( p.filename() == "prn:" );
BOOST_CHECK( p.root_name() == "prn:" );
BOOST_CHECK( p.root_directory() == "" );
BOOST_CHECK( p.root_path().string() == "prn:" );
@@ -1073,14 +1091,14 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( !p.has_root_directory() );
BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( !p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( !p.has_parent_path() );
BOOST_CHECK( !p.is_complete() );
p = path( "\\\\net\\\\\\foo" );
CHECK_EQUAL( p.relative_path().string(), "foo" );
- CHECK_EQUAL( p.branch_path().string(), "//net/" );
- CHECK_EQUAL( p.leaf(), "foo" );
+ CHECK_EQUAL( p.parent_path().string(), "//net/" );
+ CHECK_EQUAL( p.filename(), "foo" );
CHECK_EQUAL( p.root_name(), "//net" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "//net/" );
@@ -1088,8 +1106,8 @@
BOOST_CHECK( p.has_root_name() );
BOOST_CHECK( p.has_root_directory() );
BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_leaf() );
- BOOST_CHECK( p.has_branch_path() );
+ BOOST_CHECK( p.has_filename() );
+ BOOST_CHECK( p.has_parent_path() );
BOOST_CHECK( p.is_complete() );
itr_ck = path( "c:" );
@@ -1283,6 +1301,40 @@
BOOST_CHECK( acs2 >= a );
BOOST_CHECK( a2 >= as );
BOOST_CHECK( a2 >= acs );
+
+// extension() tests
+
+ BOOST_CHECK( path("a/b").extension() == "" );
+ BOOST_CHECK( path("a/b.txt").extension() == ".txt" );
+ BOOST_CHECK( path("a/b.").extension() == "." );
+ BOOST_CHECK( path("a.b.c").extension() == ".c" );
+ BOOST_CHECK( path("a.b.c.").extension() == "." );
+ BOOST_CHECK( path("").extension() == "" );
+ BOOST_CHECK( path("a/").extension() == "." );
+
+// stem() tests
+
+ BOOST_CHECK( path("b").stem() == "b" );
+ BOOST_CHECK( path("a/b.txt").stem() == "b" );
+ BOOST_CHECK( path("a/b.").stem() == "b" );
+ BOOST_CHECK( path("a.b.c").stem() == "a.b" );
+ BOOST_CHECK( path("a.b.c.").stem() == "a.b.c" );
+ BOOST_CHECK( path("").stem() == "" );
+
+// replace_extension() tests
+
+ BOOST_CHECK( path("a.txt").replace_extension("").string() == "a" );
+ BOOST_CHECK( path("a.txt").replace_extension(".").string() == "a." );
+ BOOST_CHECK( path("a.txt").replace_extension(".tex").string() == "a.tex" );
+ BOOST_CHECK( path("a.txt").replace_extension("tex").string() == "a.tex" );
+ BOOST_CHECK( path("a.").replace_extension(".tex").string() == "a.tex" );
+ BOOST_CHECK( path("a.").replace_extension("tex").string() == "a.tex" );
+ BOOST_CHECK( path("a").replace_extension(".txt").string() == "a.txt" );
+ BOOST_CHECK( path("a").replace_extension("txt").string() == "a.txt" );
+ BOOST_CHECK( path("a.b.txt" ).replace_extension(".tex").string() == "a.b.tex" );
+ BOOST_CHECK( path("a.b.txt" ).replace_extension("tex").string() == "a.b.tex" );
+ // see the rationale in html docs for explanation why this works
+ BOOST_CHECK( path("").replace_extension(".png").string() == ".png" );
// inserter and extractor tests
# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // bypass VC++ 7.0 and earlier
Modified: branches/release/libs/filesystem/test/wide_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/wide_test.cpp (original)
+++ branches/release/libs/filesystem/test/wide_test.cpp 2008-07-10 21:16:21 EDT (Thu, 10 Jul 2008)
@@ -8,12 +8,7 @@
// See library home page at http://www.boost.org/libs/filesystem
-// VC++ 8.0 warns on various less-than-safe practices.
-// See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
-// But at least in VC++ 8.0 betas, their own libraries use the problem
-// practices. So turn off the warnings.
-#define _CRT_SECURE_NO_DEPRECATE
-#define _SCL_SECURE_NO_DEPRECATE
+#include <boost/config/warning_disable.hpp>
#include <boost/filesystem/config.hpp>
# ifdef BOOST_FILESYSTEM_NARROW_ONLY
@@ -31,6 +26,7 @@
#include <iostream>
#include <iomanip>
+#include <ios>
#include <string>
#include <cerrno>
@@ -112,7 +108,7 @@
if ( convertor.out(
state, src.c_str(), src.c_str()+src.size(), from_next, work.get(),
work.get()+work_size, to_next ) != std::codecvt_base::ok )
- boost::throw_exception( "to_external conversion error" );
+ boost::throw_exception( std::runtime_error("to_external conversion error") );
*to_next = '\0';
return std::string( work.get() );
}
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