|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55556 - in sandbox/filesystem-v3: boost/filesystem libs/filesystem/src libs/filesystem/test
From: bdawes_at_[hidden]
Date: 2009-08-12 17:05:52
Author: bemandawes
Date: 2009-08-12 17:05:51 EDT (Wed, 12 Aug 2009)
New Revision: 55556
URL: http://svn.boost.org/trac/boost/changeset/55556
Log:
Linux fixes
Text files modified:
sandbox/filesystem-v3/boost/filesystem/path.hpp | 15 ++++++++++-----
sandbox/filesystem-v3/boost/filesystem/path_traits.hpp | 9 +++++++++
sandbox/filesystem-v3/libs/filesystem/src/operations.cpp | 15 ++++++++++++++-
sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp | 9 ++++++---
sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp | 16 ++++++++++++----
5 files changed, 51 insertions(+), 13 deletions(-)
Modified: sandbox/filesystem-v3/boost/filesystem/path.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path.hpp 2009-08-12 17:05:51 EDT (Wed, 12 Aug 2009)
@@ -353,11 +353,16 @@
# else // BOOST_POSIX_API
// source format
- const std::string & string() const { return m_path; }
- const std::string & string( system::error_code & ec ) const { ec.clear(); return m_path; }
-# ifndef BOOST_FILESYSTEM_NARROW_ONLY
- const std::wstring wstring( system::error_code & ec = boost::throws() ) const { return detail::convert_to_string( m_path, ec ); }
-# endif
+ const std::string & string() const { return m_path; }
+ const std::wstring wstring() const
+ {
+ std::wstring tmp;
+ if ( !m_path.empty() )
+ path_traits::convert( &*m_path.begin(), &*m_path.begin()+m_path.size(),
+ tmp, codecvt() );
+ return tmp;
+ }
+
# endif
Modified: sandbox/filesystem-v3/boost/filesystem/path_traits.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path_traits.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path_traits.hpp 2009-08-12 17:05:51 EDT (Wed, 12 Aug 2009)
@@ -88,9 +88,18 @@
convert( array, array + N - 1, to, cvt );
}
+# ifdef BOOST_WINDOWS_API
+
BOOST_FILESYSTEM_DECL
void dispatch( const directory_entry & de, std::wstring & to, const codecvt_type & );
+# else
+
+ BOOST_FILESYSTEM_DECL
+ void dispatch( const directory_entry & de, std::string & to, const codecvt_type & );
+
+# endif
+
// value types differ ---------------------------------------------------------------//
//
// A from_end argument of 0 is less efficient than a known end, so use only if needed
Modified: sandbox/filesystem-v3/libs/filesystem/src/operations.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/operations.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/operations.cpp 2009-08-12 17:05:51 EDT (Wed, 12 Aug 2009)
@@ -765,7 +765,8 @@
}
else
{
- cur.assign( buf.get(), ec );
+ cur = buf.get();
+ if ( &ec != &throws() ) ec.clear();
break;
}
}
@@ -1434,10 +1435,22 @@
namespace path_traits
{
+# ifdef BOOST_WINDOWS_API
+
void dispatch( const directory_entry & de, std::wstring & to, const codecvt_type & )
{
to = de.path().source();
}
+
+# else
+
+ void dispatch( const directory_entry & de, std::string & to, const codecvt_type & )
+ {
+ to = de.path().source();
+ }
+
+# endif
+
} // namespace path_traits
} // namespace filesystem
} // namespace boost
Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp 2009-08-12 17:05:51 EDT (Wed, 12 Aug 2009)
@@ -183,6 +183,7 @@
// catch runtime_error
+ std::cout << " catch runtime_error by value" << std::endl;
bool exception_thrown;
exception_thrown = false;
try
@@ -204,6 +205,7 @@
// catch system_error
+ std::cout << " catch system_error by value" << std::endl;
exception_thrown = false;
try
{
@@ -221,6 +223,7 @@
// catch filesystem_error by value
+ std::cout << " catch filesystem_error by value" << std::endl;
exception_thrown = false;
try
{
@@ -245,6 +248,7 @@
// catch filesystem_error by const reference
+ std::cout << " catch filesystem_error by const reference" << std::endl;
exception_thrown = false;
try
{
@@ -266,6 +270,8 @@
}
}
BOOST_TEST( exception_thrown );
+
+ std::cout << " exception_test cleanup" << std::endl;
}
// directory_iterator_tests ----------------------------------------------//
@@ -766,9 +772,6 @@
exception_tests();
- std::cout << "\ninitial_path<path>().string() is\n \""
- << fs::initial_path().string()
- << "\"\n";
std::cout << "\ninitial_path().string() is\n \""
<< fs::initial_path().string()
<< "\"\n\n";
Modified: sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp 2009-08-12 17:05:51 EDT (Wed, 12 Aug 2009)
@@ -260,7 +260,18 @@
# else // BOOST_POSIX_PATH
- ...
+ path p( "abc\\def/ghi" );
+
+ CHECK( string( p.c_str() ) == "abc\\def/ghi" );
+
+ CHECK( p.string() == "abc\\def/ghi" );
+ CHECK( p.wstring() == L"abc\\def/ghi" );
+
+ CHECK( p.generic().string() == "abc\\def/ghi" );
+ CHECK( p.generic().wstring() == L"abc\\def/ghi" );
+
+ CHECK( p.native().string() == "abc\\def/ghi" );
+ CHECK( p.native().wstring() == L"abc\\def/ghi" );
# endif
}
@@ -363,9 +374,6 @@
CHECK( p1 == "bar" );
CHECK( p2 == "foo" );
- // swap( p1, "baz" ); // should fail to compile
- // swap( p1, L"baz" ); // should fail to compile
-
CHECK( path( "" ).remove_filename() == "" );
CHECK( path( "foo" ).remove_filename() == "" );
CHECK( path( "foo/bar" ).remove_filename() == "foo/" );
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