|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67995 - in branches/release: boost boost/filesystem boost/filesystem/v2 boost/filesystem/v3 libs/filesystem libs/filesystem/build libs/filesystem/v2/doc libs/filesystem/v2/example libs/filesystem/v2/src libs/filesystem/v2/test libs/filesystem/v3/doc libs/filesystem/v3/src libs/filesystem/v3/test libs/filesystem/v3/test/msvc10 libs/filesystem/v3/test/msvc10/windows_attributes
From: bdawes_at_[hidden]
Date: 2011-01-11 16:40:00
Author: bemandawes
Date: 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
New Revision: 67995
URL: http://svn.boost.org/trac/boost/changeset/67995
Log:
Merge from trunk
Properties modified:
branches/release/boost/filesystem/ (props changed)
branches/release/boost/filesystem.hpp (contents, props changed)
branches/release/libs/filesystem/ (props changed)
Text files modified:
branches/release/boost/filesystem.hpp | 5
branches/release/boost/filesystem/config.hpp | 5
branches/release/boost/filesystem/convenience.hpp | 5
branches/release/boost/filesystem/exception.hpp | 5
branches/release/boost/filesystem/fstream.hpp | 5
branches/release/boost/filesystem/operations.hpp | 5
branches/release/boost/filesystem/path.hpp | 5
branches/release/boost/filesystem/v2/config.hpp | 10 +
branches/release/boost/filesystem/v2/convenience.hpp | 11 +
branches/release/boost/filesystem/v2/fstream.hpp | 1
branches/release/boost/filesystem/v2/operations.hpp | 57 ++++----
branches/release/boost/filesystem/v2/path.hpp | 9
branches/release/boost/filesystem/v3/operations.hpp | 22 ++-
branches/release/boost/filesystem/v3/path.hpp | 2
branches/release/libs/filesystem/build/Jamfile.v2 | 37 +++++-
branches/release/libs/filesystem/index.html | 6
branches/release/libs/filesystem/v2/doc/index.htm | 44 +++++-
branches/release/libs/filesystem/v2/example/mbcopy.cpp | 2
branches/release/libs/filesystem/v2/example/mbpath.cpp | 2
branches/release/libs/filesystem/v2/example/simple_ls.cpp | 2
branches/release/libs/filesystem/v2/src/v2_operations.cpp | 12 +-
branches/release/libs/filesystem/v2/src/v2_path.cpp | 6
branches/release/libs/filesystem/v2/test/convenience_test.cpp | 6
branches/release/libs/filesystem/v2/test/deprecated_test.cpp | 5
branches/release/libs/filesystem/v2/test/fstream_test.cpp | 5
branches/release/libs/filesystem/v2/test/large_file_support_test.cpp | 2
branches/release/libs/filesystem/v2/test/operations_test.cpp | 17 +-
branches/release/libs/filesystem/v2/test/path_test.cpp | 9 +
branches/release/libs/filesystem/v2/test/wide_test.cpp | 9 +
branches/release/libs/filesystem/v3/doc/index.htm | 47 +++++--
branches/release/libs/filesystem/v3/doc/reference.html | 48 +++++++
branches/release/libs/filesystem/v3/src/operations.cpp | 61 +++++++++
branches/release/libs/filesystem/v3/src/windows_file_codecvt.cpp | 6
branches/release/libs/filesystem/v3/test/convenience_test.cpp | 3
branches/release/libs/filesystem/v3/test/deprecated_test.cpp | 3
branches/release/libs/filesystem/v3/test/fstream_test.cpp | 3
branches/release/libs/filesystem/v3/test/msvc10/filesystem-v3.sln | 39 ++++++
branches/release/libs/filesystem/v3/test/msvc10/windows_attributes/windows_attributes.vcxproj | 10 +
branches/release/libs/filesystem/v3/test/operations_test.cpp | 238 ++++++++++++++++++++++++++++++++++++---
branches/release/libs/filesystem/v3/test/operations_unit_test.cpp | 3
branches/release/libs/filesystem/v3/test/path_test.cpp | 3
branches/release/libs/filesystem/v3/test/path_unit_test.cpp | 45 +++---
branches/release/libs/filesystem/v3/test/windows_attributes.cpp | 34 +++++
43 files changed, 687 insertions(+), 167 deletions(-)
Modified: branches/release/boost/filesystem.hpp
==============================================================================
--- branches/release/boost/filesystem.hpp (original)
+++ branches/release/boost/filesystem.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_FILESYSTEM_HPP
#define BOOST_FILESYSTEM_FILESYSTEM_HPP
+#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
+ // BOOST_FILESYSTEM_VERSION defined there
+
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
-# define BOOST_FILESYSTEM_VERSION 2
+# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2
Modified: branches/release/boost/filesystem/config.hpp
==============================================================================
--- branches/release/boost/filesystem/config.hpp (original)
+++ branches/release/boost/filesystem/config.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_CONFIGX_HPP
#define BOOST_FILESYSTEM_CONFIGX_HPP
+#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
+ // BOOST_FILESYSTEM_VERSION defined there
+
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
-# define BOOST_FILESYSTEM_VERSION 2
+# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2
Modified: branches/release/boost/filesystem/convenience.hpp
==============================================================================
--- branches/release/boost/filesystem/convenience.hpp (original)
+++ branches/release/boost/filesystem/convenience.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_CONVENIENCEX_HPP
#define BOOST_FILESYSTEM_CONVENIENCEX_HPP
+#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
+ // BOOST_FILESYSTEM_VERSION defined there
+
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
-# define BOOST_FILESYSTEM_VERSION 2
+# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2
Modified: branches/release/boost/filesystem/exception.hpp
==============================================================================
--- branches/release/boost/filesystem/exception.hpp (original)
+++ branches/release/boost/filesystem/exception.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_EXCEPTIONX_HPP
#define BOOST_FILESYSTEM_EXCEPTIONX_HPP
+#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
+ // BOOST_FILESYSTEM_VERSION defined there
+
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
-# define BOOST_FILESYSTEM_VERSION 2
+# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2
Modified: branches/release/boost/filesystem/fstream.hpp
==============================================================================
--- branches/release/boost/filesystem/fstream.hpp (original)
+++ branches/release/boost/filesystem/fstream.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_FSTREAMX_HPP
#define BOOST_FILESYSTEM_FSTREAMX_HPP
+#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
+ // BOOST_FILESYSTEM_VERSION defined there
+
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
-# define BOOST_FILESYSTEM_VERSION 2
+# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2
Modified: branches/release/boost/filesystem/operations.hpp
==============================================================================
--- branches/release/boost/filesystem/operations.hpp (original)
+++ branches/release/boost/filesystem/operations.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_OPERATIONSX_HPP
#define BOOST_FILESYSTEM_OPERATIONSX_HPP
+#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
+ // BOOST_FILESYSTEM_VERSION defined there
+
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
-# define BOOST_FILESYSTEM_VERSION 2
+# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2
Modified: branches/release/boost/filesystem/path.hpp
==============================================================================
--- branches/release/boost/filesystem/path.hpp (original)
+++ branches/release/boost/filesystem/path.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_PATHX_HPP
#define BOOST_FILESYSTEM_PATHX_HPP
+#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
+ // BOOST_FILESYSTEM_VERSION defined there
+
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
-# define BOOST_FILESYSTEM_VERSION 2
+# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2
Modified: branches/release/boost/filesystem/v2/config.hpp
==============================================================================
--- branches/release/boost/filesystem/v2/config.hpp (original)
+++ branches/release/boost/filesystem/v2/config.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -51,6 +51,16 @@
# endif
# endif
+// throw an exception ----------------------------------------------------------------//
+//
+// Exceptions were originally thrown via boost::throw_exception().
+// As throw_exception() became more complex, it caused user error reporting
+// to be harder to interpret, since the exception reported became much more complex.
+// The immediate fix was to throw directly, wrapped in a macro to make any later change
+// easier.
+
+#define BOOST_FILESYSTEM_THROW(EX) throw EX
+
// narrow support only for badly broken compilers or libraries -------------//
# if defined(BOOST_NO_STD_WSTRING) || defined(BOOST_NO_SFINAE) || defined(BOOST_NO_STD_LOCALE) || BOOST_WORKAROUND(__BORLANDC__, <0x610)
Modified: branches/release/boost/filesystem/v2/convenience.hpp
==============================================================================
--- branches/release/boost/filesystem/v2/convenience.hpp (original)
+++ branches/release/boost/filesystem/v2/convenience.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -13,7 +13,8 @@
#ifndef BOOST_FILESYSTEM2_CONVENIENCE_HPP
#define BOOST_FILESYSTEM2_CONVENIENCE_HPP
-#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/v2/config.hpp>
+#include <boost/filesystem/v2/operations.hpp>
#include <boost/system/error_code.hpp>
#include <vector>
#include <stack>
@@ -85,11 +86,11 @@
# if !defined(_STLPORT_VERSION)
return ph.parent_path() / (basename(ph) + new_extension);
# else
- typedef BOOST_FS_TYPENAME Path::string_type string_type;
- string_type filename = basename(ph) + new_extension;
- return ph.parent_path() / filename;
+ typedef BOOST_FS_TYPENAME Path::string_type string_type;
+ string_type filename = basename(ph) + new_extension;
+ return ph.parent_path() / filename;
# endif
- }
+ }
# endif
# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
Modified: branches/release/boost/filesystem/v2/fstream.hpp
==============================================================================
--- branches/release/boost/filesystem/v2/fstream.hpp (original)
+++ branches/release/boost/filesystem/v2/fstream.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -12,6 +12,7 @@
#ifndef BOOST_FILESYSTEM2_FSTREAM_HPP
#define BOOST_FILESYSTEM2_FSTREAM_HPP
+#include <boost/filesystem/v2/config.hpp>
#include <boost/filesystem/v2/operations.hpp> // for 8.3 hack (see below)
#include <boost/utility/enable_if.hpp>
#include <boost/detail/workaround.hpp>
Modified: branches/release/boost/filesystem/v2/operations.hpp
==============================================================================
--- branches/release/boost/filesystem/v2/operations.hpp (original)
+++ branches/release/boost/filesystem/v2/operations.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -14,6 +14,7 @@
#ifndef BOOST_FILESYSTEM2_OPERATIONS_HPP
#define BOOST_FILESYSTEM2_OPERATIONS_HPP
+#include <boost/filesystem/v2/config.hpp>
#include <boost/filesystem/v2/path.hpp>
#include <boost/detail/scoped_enum_emulation.hpp>
@@ -258,7 +259,7 @@
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_THROW( basic_filesystem_error<Path>(
"boost::filesystem::status", ph, ec ) );
return result;
}
@@ -277,7 +278,7 @@
system::error_code ec;
file_status result( symlink_status( ph, ec ) );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::symlink_status", ph, ec ) );
return result;
}
@@ -292,7 +293,7 @@
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_THROW( basic_filesystem_error<Path>(
"boost::filesystem::exists", ph, ec ) );
return exists( result );
}
@@ -302,7 +303,7 @@
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_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_directory", ph, ec ) );
return is_directory( result );
}
@@ -312,7 +313,7 @@
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_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_regular_file", ph, ec ) );
return is_regular_file( result );
}
@@ -323,7 +324,7 @@
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_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_regular", ph, ec ) );
return is_regular( result );
}
@@ -334,7 +335,7 @@
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_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_other", ph, ec ) );
return is_other( result );
}
@@ -350,7 +351,7 @@
system::error_code ec;
file_status result( detail::symlink_status_api( ph.external_file_string(), ec ) );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_symlink", ph, ec ) );
return is_symlink( result );
# endif
@@ -369,7 +370,7 @@
detail::query_pair result(
detail::is_empty_api( ph.external_file_string() ) );
if ( result.first )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_empty", ph, result.first ) );
return result.second;
}
@@ -379,7 +380,7 @@
detail::query_pair result( detail::equivalent_api(
ph1.external_file_string(), ph2.external_file_string() ) );
if ( result.first )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::equivalent", ph1, ph2, result.first ) );
return result.second;
}
@@ -389,7 +390,7 @@
detail::uintmax_pair result
( detail::file_size_api( ph.external_file_string() ) );
if ( result.first )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::file_size", ph, result.first ) );
return result.second;
}
@@ -399,7 +400,7 @@
detail::space_pair result
( detail::space_api( ph.external_file_string() ) );
if ( result.first )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::space", ph, result.first ) );
return result.second;
}
@@ -409,7 +410,7 @@
detail::time_pair result
( detail::last_write_time_api( ph.external_file_string() ) );
if ( result.first )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::last_write_time", ph, result.first ) );
return result.second;
}
@@ -422,7 +423,7 @@
detail::query_pair result(
detail::create_directory_api( dir_ph.external_directory_string() ) );
if ( result.first )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::create_directory",
dir_ph, result.first ) );
return result.second;
@@ -437,7 +438,7 @@
to_ph.external_file_string(),
from_ph.external_file_string() ) );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::create_hard_link",
to_ph, from_ph, ec ) );
}
@@ -461,7 +462,7 @@
to_ph.external_file_string(),
from_ph.external_file_string() ) );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::create_symlink",
to_ph, from_ph, ec ) );
}
@@ -481,7 +482,7 @@
system::error_code ec;
file_status f = symlink_status( ph, ec );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::remove", ph, ec ) );
return detail::remove_aux( ph, f );
}
@@ -491,7 +492,7 @@
system::error_code ec;
file_status f = symlink_status( ph, ec );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::remove_all", ph, ec ) );
return exists( f ) ? detail::remove_all_aux( ph, f ) : 0;
}
@@ -502,7 +503,7 @@
from_path.external_directory_string(),
to_path.external_directory_string() ) );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::rename",
from_path, to_path, ec ) );
}
@@ -518,7 +519,7 @@
from_path.external_directory_string(),
to_path.external_directory_string(), option == copy_option::fail_if_exists ) );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::copy_file",
from_path, to_path, ec ) );
}
@@ -529,7 +530,7 @@
typename Path::external_string_type ph;
system::error_code ec( detail::get_current_path_api( ph ) );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::current_path", ec ) );
return Path( Path::traits_type::to_internal( ph ) );
}
@@ -539,7 +540,7 @@
system::error_code ec( detail::set_current_path_api(
ph.external_directory_string() ) );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::current_path", ph, ec ) );
}
@@ -567,7 +568,7 @@
system::error_code ec( detail::get_full_path_name_api( ph.external_file_string(),
sys_ph ) );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::system_complete", ph, ec ) );
return Path( Path::traits_type::to_internal( sys_ph ) );
# else
@@ -606,7 +607,7 @@
system::error_code ec( detail::last_write_time_api( ph.external_file_string(),
new_time ) );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::last_write_time", ph, ec ) );
}
@@ -782,7 +783,7 @@
{
system::error_code ec = remove_api( ph.external_file_string() );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::remove", ph, ec ) );
return true;
}
@@ -803,7 +804,7 @@
boost::system::error_code ec;
boost::filesystem2::file_status fn = boost::filesystem2::symlink_status( itr->path(), ec );
if ( ec )
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem:remove_all", ph, ec ) );
count += remove_all_aux( itr->path(), fn );
}
@@ -980,7 +981,7 @@
system::error_code ec( m_init(dir_path) );
if ( ec )
{
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::basic_directory_iterator constructor",
dir_path, ec ) );
}
@@ -1013,7 +1014,7 @@
name, fs, symlink_fs );
if ( ec )
{
- boost::throw_exception( basic_filesystem_error<Path>(
+ BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::basic_directory_iterator increment",
m_imp->m_directory_entry.path().parent_path(), ec ) );
}
Modified: branches/release/boost/filesystem/v2/path.hpp
==============================================================================
--- branches/release/boost/filesystem/v2/path.hpp (original)
+++ branches/release/boost/filesystem/v2/path.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -20,16 +20,15 @@
#include <boost/filesystem/v2/config.hpp>
#include <boost/system/system_error.hpp>
#include <boost/iterator/iterator_facade.hpp>
-#include <boost/throw_exception.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/static_assert.hpp>
+#include <boost/assert.hpp>
#include <string>
#include <algorithm> // for lexicographical_compare
#include <iosfwd> // needed by basic_path inserter and extractor
#include <stdexcept>
-#include <cassert>
# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
# include <locale>
@@ -916,7 +915,7 @@
boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits>
path_type;
- assert( !str.empty() && str[pos] == slash<path_type>::value
+ BOOST_ASSERT( !str.empty() && str[pos] == slash<path_type>::value
&& "precondition violation" );
// subsequent logic expects pos to be for leftmost slash of a set
@@ -1380,7 +1379,7 @@
typedef typename Path::string_type string_type;
typedef typename Path::traits_type traits_type;
- assert( itr.m_pos < itr.m_path_ptr->m_path.size() && "basic_path::iterator increment past end()" );
+ BOOST_ASSERT( itr.m_pos < itr.m_path_ptr->m_path.size() && "basic_path::iterator increment past end()" );
bool was_net( itr.m_name.size() > 2
&& itr.m_name[0] == slash<Path>::value
@@ -1439,7 +1438,7 @@
template<class Path>
void iterator_helper<Path>::do_decrement( iterator & itr )
{
- assert( itr.m_pos && "basic_path::iterator decrement past begin()" );
+ BOOST_ASSERT( itr.m_pos && "basic_path::iterator decrement past begin()" );
typedef typename Path::string_type string_type;
typedef typename Path::traits_type traits_type;
Modified: branches/release/boost/filesystem/v3/operations.hpp
==============================================================================
--- branches/release/boost/filesystem/v3/operations.hpp (original)
+++ branches/release/boost/filesystem/v3/operations.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -75,8 +75,8 @@
fifo_file,
socket_file,
reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink
- type_unknown, // file does exist, but isn't one of the above types or
- // we don't have strong enough permission to find its type
+ type_unknown, // file does exist, but isn't one of the above types or
+ // we don't have strong enough permission to find its type
_detail_directory_symlink // internal use only; never exposed to users
};
@@ -191,6 +191,8 @@
BOOST_FILESYSTEM_DECL
path system_complete(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
+ path temp_directory_path(system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
path unique_path(const path& p, system::error_code* ec=0);
} // namespace detail
@@ -258,9 +260,7 @@
// forward declarations
path current_path(); // fwd declaration
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
path initial_path();
-# endif
BOOST_FILESYSTEM_DECL
path absolute(const path& p, const path& base=current_path());
@@ -372,7 +372,6 @@
inline
boost::uintmax_t hard_link_count(const path& p, system::error_code& ec)
{return detail::hard_link_count(p, &ec);}
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline
path initial_path() {return detail::initial_path();}
@@ -383,7 +382,6 @@
path initial_path() {return initial_path();}
template <class Path>
path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
-# endif
inline
std::time_t last_write_time(const path& p) {return detail::last_write_time(p);}
@@ -446,6 +444,12 @@
path system_complete(const path& p, system::error_code& ec)
{return detail::system_complete(p, &ec);}
inline
+ path temp_directory_path() {return detail::temp_directory_path();}
+
+ inline
+ path temp_directory_path(system::error_code& ec)
+ {return detail::temp_directory_path(&ec);}
+ inline
path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%")
{ return detail::unique_path(p); }
inline
@@ -799,7 +803,8 @@
{
BOOST_ASSERT(m_imp.get() && "increment of end recursive_directory_iterator");
m_imp->increment(0);
- if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator
+ if (m_imp->m_stack.empty())
+ m_imp.reset(); // done, so make end iterator
}
bool equal(const recursive_directory_iterator& rhs) const
@@ -963,6 +968,7 @@
using filesystem3::file_type;
using filesystem3::filesystem_error;
using filesystem3::hard_link_count;
+ using filesystem3::initial_path;
using filesystem3::is_directory;
using filesystem3::is_directory;
using filesystem3::is_empty;
@@ -986,10 +992,10 @@
using filesystem3::symlink_file;
using filesystem3::symlink_status;
using filesystem3::system_complete;
+ using filesystem3::temp_directory_path;
using filesystem3::type_unknown;
using filesystem3::unique_path;
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
- using filesystem3::initial_path;
using filesystem3::is_regular;
using filesystem3::status_unknown;
using filesystem3::symbolic_link_exists;
Modified: branches/release/boost/filesystem/v3/path.hpp
==============================================================================
--- branches/release/boost/filesystem/v3/path.hpp (original)
+++ branches/release/boost/filesystem/v3/path.hpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -479,7 +479,7 @@
class path::iterator
: public boost::iterator_facade<
- iterator,
+ path::iterator,
path const,
boost::bidirectional_traversal_tag >
{
Modified: branches/release/libs/filesystem/build/Jamfile.v2
==============================================================================
--- branches/release/libs/filesystem/build/Jamfile.v2 (original)
+++ branches/release/libs/filesystem/build/Jamfile.v2 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -13,13 +13,36 @@
<link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
;
-SOURCES =
- v2/src/v2_operations v2/src/v2_path v2/src/v2_portability
- v3/src/operations v3/src/path v3/src/portability v3/src/utf8_codecvt_facet
- v3/src/codecvt_error_category v3/src/path_traits v3/src/unique_path
- v3/src/windows_file_codecvt
- ;
-
+local disable-filesystem2 = [ MATCH (--disable-filesystem2) : [ modules.peek : ARGV ] ] ;
+local disable-filesystem3 = [ MATCH (--disable-filesystem3) : [ modules.peek : ARGV ] ] ;
+
+if ! $(disable-filesystem2)
+{
+ if ! $(disable-filesystem3)
+ {
+ SOURCES =
+ v2/src/v2_operations v2/src/v2_path v2/src/v2_portability
+ v3/src/operations v3/src/path v3/src/portability v3/src/windows_file_codecvt
+ v3/src/codecvt_error_category v3/src/path_traits v3/src/unique_path
+ v3/src/utf8_codecvt_facet
+ ;
+ }
+ else
+ {
+ SOURCES =
+ v2/src/v2_operations v2/src/v2_path v2/src/v2_portability
+ v3/src/utf8_codecvt_facet # used by both v2 and v3
+ ;
+ }
+}
+else
+{
+ SOURCES =
+ v3/src/operations v3/src/path v3/src/portability v3/src/windows_file_codecvt
+ v3/src/codecvt_error_category v3/src/path_traits v3/src/unique_path
+ v3/src/utf8_codecvt_facet
+ ;
+}
lib boost_filesystem
: $(SOURCES).cpp ../../system/build//boost_system
Modified: branches/release/libs/filesystem/index.html
==============================================================================
--- branches/release/libs/filesystem/index.html (original)
+++ branches/release/libs/filesystem/index.html 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -1,14 +1,14 @@
<html>
<head>
-<meta http-equiv="refresh" content="0; URL=v2/doc/index.htm">
+<meta http-equiv="refresh" content="0; URL=v3/doc/index.htm">
</head>
<body>
Automatic redirection failed, please go to
-v2/doc/index.htm.
+v3/doc/index.htm.
<hr>
<p>© Copyright Beman Dawes, 2003</p>
<p> Distributed under the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
www.boost.org/LICENSE_1_0.txt</a>)</p>
</body>
-</html>
+</html>
\ No newline at end of file
Modified: branches/release/libs/filesystem/v2/doc/index.htm
==============================================================================
--- branches/release/libs/filesystem/v2/doc/index.htm (original)
+++ branches/release/libs/filesystem/v2/doc/index.htm 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -72,15 +72,41 @@
<table border="1" cellpadding="10" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td>
- <p align="center"><b>This is Version 2 of the Filesystem library.</b></p>
- <p align="center">Version 3, a major revision with many new and improved
- features is also available, but breaks some existing code.</p>
- <p align="center">Version 2 is the default version for Boost release 1.44
- only. Version 3 will become the default starting with release 1.45.</p>
- <p align="center">Existing code should be moved to version 3 as soon as
+ <p align="center"><b>This is the home page for Version 2 of the Filesystem library.</b></p>
+ <p align="left">Version 3, a major revision with many new and improved
+ features, is also available. Version 3 may break some user code written
+ for Version 2.</p>
+ <p align="left">To ease the transition, Boost releases 1.44 through 1.47
+ will supply both V2 and V3. Version 2 is the default version for Boost release 1.44
+ and 1.45. Version 3 will be the default starting with release 1.46.</p>
+ <p align="left"><b>Define macro BOOST_FILESYSTEM_VERSION as 3 to use
+ Version 3. This will be the default for release 1.46 and later.</b></p>
+ <p align="left"><b>Define macro BOOST_FILESYSTEM_VERSION as 2 to use
+ Version 2. This is the default for release 1.44 and 1.45.</b></p>
+ <p align="left"><b>You may define the BOOST_FILESYSTEM_VERSION macro:</b></p>
+ <ul>
+ <li>
+ <p align="left"><b>On the build command line; the exact format depends on
+ your compiler or IDE</b></p>
+ </li>
+ <li>
+ <p align="left"><b>In your code, before including any filesystem header,
+ #define BOOST_FILESYSTEM_VERSION <i>n</i></b></p>
+ </li>
+ <li>
+ <p align="left"><b>#define BOOST_FILESYSTEM_VERSION <i>n </i>in boost/config/user.hpp.
+ Note that this approach applies to all uses of Boost.Filesystem.</b></p>
+ </li>
+ </ul>
+ <p align="left">Existing code should be moved to version 3 as soon as
convenient. New code should be written for version 3.</p>
- <p align="center">Version 2 is deprecated, and will be removed from Boost
- releases at the end of a transition period.</p>
+ <p align="left">Version 2 is deprecated, and will not be included in Boost
+ releases 1.48 and later.</p>
+ <p align="left"><b>Building the library</b></p>
+ <p align="left">By default, the Boost build system creates libraries that
+ support both version 2 and version 3. To support only a single version,
+ include <code>--disable-filesystem2</code> or <code>--disable-filesystem3</code>
+ on the <code>bjam</code> command line.</p>
</td>
</tr>
</table>
@@ -797,7 +823,7 @@
<hr>
<p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->21 June, 2010<!--webbot bot="Timestamp" endspan i-checksum="19840" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->06 December, 2010<!--webbot bot="Timestamp" endspan i-checksum="38640" --></p>
<p>© Copyright Beman Dawes, 2002-2005</p>
<p> Use, modification, and distribution are subject to the Boost Software
Modified: branches/release/libs/filesystem/v2/example/mbcopy.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/example/mbcopy.cpp (original)
+++ branches/release/libs/filesystem/v2/example/mbcopy.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -9,6 +9,8 @@
// Copy the files in a directory, using mbpath to represent the new file names
// See http://../doc/path.htm#mbpath for more information
+#define BOOST_FILESYSTEM_VERSION 2
+
// See deprecated_test for tests of deprecated features
#define BOOST_FILESYSTEM_NO_DEPRECATED
Modified: branches/release/libs/filesystem/v2/example/mbpath.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/example/mbpath.cpp (original)
+++ branches/release/libs/filesystem/v2/example/mbpath.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -8,6 +8,8 @@
// See Boost.Filesystem home page at http://www.boost.org/libs/filesystem
+#define BOOST_FILESYSTEM_VERSION 2
+
#include <boost/filesystem/config.hpp>
# ifdef BOOST_FILESYSTEM2_NARROW_ONLY
# error This compiler or standard library does not support wide-character strings or paths
Modified: branches/release/libs/filesystem/v2/example/simple_ls.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/example/simple_ls.cpp (original)
+++ branches/release/libs/filesystem/v2/example/simple_ls.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -8,6 +8,8 @@
// See http://www.boost.org/libs/filesystem for documentation.
+#define BOOST_FILESYSTEM_VERSION 2
+
// As an example program, we don't want to use any deprecated features
#define BOOST_FILESYSTEM_NO_DEPRECATED
Modified: branches/release/libs/filesystem/v2/src/v2_operations.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/src/v2_operations.cpp (original)
+++ branches/release/libs/filesystem/v2/src/v2_operations.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -44,7 +44,7 @@
#include <boost/filesystem/v2/operations.hpp>
#include <boost/scoped_array.hpp>
-#include <boost/throw_exception.hpp>
+#include <boost/assert.hpp>
#include <boost/detail/workaround.hpp>
#include <cstdlib> // for malloc, free
@@ -93,7 +93,6 @@
#include <cstring>
#include <cstdio> // for remove, rename
#include <cerrno>
-#include <cassert>
// #include <iostream> // for debugging only; comment out when not in use
#ifdef BOOST_NO_STDC_NAMESPACE
@@ -294,7 +293,7 @@
if ( p1.handle != INVALID_HANDLE_VALUE
|| p2.handle != INVALID_HANDLE_VALUE )
{ return std::make_pair( ok, false ); }
- assert( p1.handle == INVALID_HANDLE_VALUE
+ BOOST_ASSERT( p1.handle == INVALID_HANDLE_VALUE
&& p2.handle == INVALID_HANDLE_VALUE );
{ return std::make_pair( error_code( error1, system_category()), false ); }
}
@@ -724,7 +723,7 @@
|| ((mode&~std::ios_base::binary)
== (std::ios_base::in|std::ios_base::out|std::ios_base::trunc)) )
disposition = CREATE_ALWAYS;
- else assert( 0 && "invalid mode argument" );
+ else BOOST_ASSERT( 0 && "invalid mode argument" );
HANDLE handle ( ::CreateFileW( ph.c_str(), access,
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
@@ -1215,8 +1214,9 @@
if ( ::stat( from_file_ph.c_str(), &from_stat ) != 0 )
{ return error_code( errno, system_category() ); }
- int oflag = O_CREAT | O_WRONLY;
- if ( fail_if_exists ) oflag |= O_EXCL;
+ int oflag = O_CREAT | O_WRONLY | O_TRUNC;
+ if ( fail_if_exists )
+ oflag |= O_EXCL;
if ( (outfile = ::open( to_file_ph.c_str(), oflag, from_stat.st_mode )) < 0 )
{
int open_errno = errno;
Modified: branches/release/libs/filesystem/v2/src/v2_path.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/src/v2_path.cpp (original)
+++ branches/release/libs/filesystem/v2/src/v2_path.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -86,7 +86,7 @@
void wpath_traits::imbue( const std::locale & new_loc )
{
- if ( locked ) boost::throw_exception(
+ if ( locked ) BOOST_FILESYSTEM_THROW(
wfilesystem_error(
"boost::filesystem::wpath_traits::imbue() after lockdown",
make_error_code( system::errc::not_supported ) ) );
@@ -144,7 +144,7 @@
if ( converter()->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( boost::filesystem::wfilesystem_error(
+ BOOST_FILESYSTEM_THROW( boost::filesystem::wfilesystem_error(
"boost::filesystem::wpath::to_external conversion error",
ph, system::error_code( system::errc::invalid_argument, system::system_category() ) ) );
*to_next = '\0';
@@ -163,7 +163,7 @@
if ( converter()->in(
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( boost::filesystem::wfilesystem_error(
+ BOOST_FILESYSTEM_THROW( boost::filesystem::wfilesystem_error(
"boost::filesystem::wpath::to_internal conversion error",
system::error_code( system::errc::invalid_argument, system::system_category() ) ) );
*to_next = L'\0';
Modified: branches/release/libs/filesystem/v2/test/convenience_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/test/convenience_test.cpp (original)
+++ branches/release/libs/filesystem/v2/test/convenience_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -8,6 +8,8 @@
// See library home page at http://www.boost.org/libs/filesystem
+#define BOOST_FILESYSTEM_VERSION 2
+
#include <boost/config/warning_disable.hpp>
// See deprecated_test for tests of deprecated features
@@ -24,6 +26,8 @@
namespace sys = boost::system;
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
+
#include <boost/bind.hpp>
#include <fstream>
#include <iostream>
@@ -58,7 +62,7 @@
// --------------------------------------------------------------------------//
-int main( int, char*[] )
+int cpp_main( int, char*[] )
{
// create_directories() tests ----------------------------------------------//
Modified: branches/release/libs/filesystem/v2/test/deprecated_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/test/deprecated_test.cpp (original)
+++ branches/release/libs/filesystem/v2/test/deprecated_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -12,8 +12,11 @@
// This test verifies that various deprecated names still compile. This is
// important to preserve existing code that uses the old names.
+#define BOOST_FILESYSTEM_VERSION 2
+
#include <boost/filesystem.hpp>
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
namespace fs = boost::filesystem;
using boost::filesystem::path;
@@ -145,7 +148,7 @@
//----------------------------------------------------------------------------//
-int main( int /*argc*/, char * /*argv*/[] )
+int cpp_main( int /*argc*/, char * /*argv*/[] )
{
// The choice of platform is make at runtime rather than compile-time
// so that compile errors for all platforms will be detected even though
Modified: branches/release/libs/filesystem/v2/test/fstream_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/test/fstream_test.cpp (original)
+++ branches/release/libs/filesystem/v2/test/fstream_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -7,6 +7,8 @@
// See library home page at http://www.boost.org/libs/filesystem
+#define BOOST_FILESYSTEM_VERSION 2
+
#include <boost/config/warning_disable.hpp>
// See deprecated_test for tests of deprecated features
@@ -37,6 +39,7 @@
#endif
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
namespace
{
@@ -148,7 +151,7 @@
} // test
} // unnamed namespace
-int main( int argc, char*[] )
+int cpp_main( int argc, char*[] )
{
if ( argc > 1 ) cleanup = false;
Modified: branches/release/libs/filesystem/v2/test/large_file_support_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/test/large_file_support_test.cpp (original)
+++ branches/release/libs/filesystem/v2/test/large_file_support_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -7,6 +7,8 @@
// See library home page at http://www.boost.org/libs/filesystem
+#define BOOST_FILESYSTEM_VERSION 2
+
// See deprecated_test for tests of deprecated features
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
# define BOOST_FILESYSTEM_NO_DEPRECATED
Modified: branches/release/libs/filesystem/v2/test/operations_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/test/operations_test.cpp (original)
+++ branches/release/libs/filesystem/v2/test/operations_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -7,6 +7,8 @@
// See library home page at http://www.boost.org/libs/filesystem
+#define BOOST_FILESYSTEM_VERSION 2
+
#include <boost/config/warning_disable.hpp>
// See deprecated_test for tests of deprecated features
@@ -24,6 +26,7 @@
#include <boost/config.hpp>
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
using boost::system::error_code;
using boost::system::system_category;
@@ -77,8 +80,8 @@
{
std::ofstream f( ph.file_string().c_str() );
if ( !f )
- throw fs::filesystem_error( "operations_test create_file",
- ph, error_code(errno, system_category()) );
+ BOOST_FILESYSTEM_THROW( fs::filesystem_error( "operations_test create_file",
+ ph, error_code(errno, system_category()) ) );
if ( !contents.empty() ) f << contents;
}
@@ -86,13 +89,13 @@
{
std::ifstream f( ph.file_string().c_str() );
if ( !f )
- throw fs::filesystem_error( "operations_test verify_file",
- ph, error_code(errno, system_category()) );
+ BOOST_FILESYSTEM_THROW( fs::filesystem_error( "operations_test verify_file",
+ ph, error_code(errno, system_category()) ) );
std::string contents;
f >> contents;
if ( contents != expected )
- throw fs::filesystem_error( "operations_test verify_file contents \""
- + contents + "\" != \"" + expected + "\"", ph, error_code() );
+ BOOST_FILESYSTEM_THROW( fs::filesystem_error( "operations_test verify_file contents \""
+ + contents + "\" != \"" + expected + "\"", ph, error_code() ) );
}
template< typename F >
@@ -264,7 +267,7 @@
// main ------------------------------------------------------------------------------//
-int main( int argc, char * argv[] )
+int cpp_main( int argc, char * argv[] )
{
if ( argc > 1 && *argv[1]=='-' && *(argv[1]+1)=='t' ) report_throws = true;
Modified: branches/release/libs/filesystem/v2/test/path_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/test/path_test.cpp (original)
+++ branches/release/libs/filesystem/v2/test/path_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -13,6 +13,8 @@
// on basename(), extension(), and change_extension() tests from the original
// convenience_test.cpp by Vladimir Prus.
+#define BOOST_FILESYSTEM_VERSION 2
+
// See deprecated_test for tests of deprecated features
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
# define BOOST_FILESYSTEM_NO_DEPRECATED
@@ -35,6 +37,7 @@
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
#define PATH_CHECK( a, b ) check( a, b, __LINE__ )
#define DIR_CHECK( a, b ) check_dir( a, b, __LINE__ )
@@ -87,7 +90,7 @@
{
const std::string str_1("string-1");
boost::system::error_code ec( 12345, boost::system::system_category());
- try { throw fs::filesystem_error( str_1, ec ); }
+ try { BOOST_FILESYSTEM_THROW( fs::filesystem_error( str_1, ec ) ); }
catch ( const fs::filesystem_error & ex )
{
//std::cout << ex.what() << "*" << std::endl;
@@ -96,7 +99,7 @@
BOOST_TEST( ex.code() == ec );
}
- try { throw fs::filesystem_error( str_1, "p1", "p2", ec ); }
+ try { BOOST_FILESYSTEM_THROW( fs::filesystem_error( str_1, "p1", "p2", ec ) ); }
catch ( const fs::filesystem_error & ex )
{
//std::cout << ex.what() << "*" << std::endl;
@@ -194,7 +197,7 @@
} // unnamed namespace
-int main( int, char*[] )
+int cpp_main( int, char* [] )
{
// The choice of platform is make at runtime rather than compile-time
// so that compile errors for all platforms will be detected even though
Modified: branches/release/libs/filesystem/v2/test/wide_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v2/test/wide_test.cpp (original)
+++ branches/release/libs/filesystem/v2/test/wide_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -8,6 +8,8 @@
// See library home page at http://www.boost.org/libs/filesystem
+#define BOOST_FILESYSTEM_VERSION 2
+
#include <boost/config/warning_disable.hpp>
// See deprecated_test for tests of deprecated features
@@ -27,6 +29,7 @@
#include <boost/filesystem/fstream.hpp>
#include <boost/scoped_array.hpp>
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
@@ -54,9 +57,9 @@
std::ofstream f( ph.external_file_string().c_str() );
# endif
if ( !f )
- throw fs::basic_filesystem_error<Path>( "wide_test create_file",
+ BOOST_FILESYSTEM_THROW( fs::basic_filesystem_error<Path>( "wide_test create_file",
ph,
- boost::system::error_code( errno, boost::system::generic_category() ) );
+ boost::system::error_code( errno, boost::system::generic_category() ) ) );
if ( !contents.empty() ) f << contents;
}
@@ -125,7 +128,7 @@
// main ------------------------------------------------------------------------------//
-int main( int argc, char * /*argv*/[] )
+int cpp_main( int argc, char * /*argv*/[] )
{
if ( argc > 1 ) cleanup = false;
Modified: branches/release/libs/filesystem/v3/doc/index.htm
==============================================================================
--- branches/release/libs/filesystem/v3/doc/index.htm (original)
+++ branches/release/libs/filesystem/v3/doc/index.htm 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -66,18 +66,41 @@
<table border="1" cellpadding="10" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td>
- <p align="center"><b>This is Version 3 of the Filesystem library.</b></p>
- <p align="center">Version 3 is a major revision with many new and improved
- features. It breaks some Version 2 code.</p>
- <p align="center">Version 2 is the default version for Boost release 1.44
- only. Version 3 will become the default starting with release 1.45.</p>
- <p align="center"><b>For this release only, you must define macro
- BOOST_FILESYSTEM_VERSION as 3 to use Version 3. You may do this via a
- compiler argument or via <code>#define BOOST_FILESYSTEM_VERSION 3</code></b></p>
- <p align="center">Existing code should be moved to Version 3 as soon as
+ <p align="center"><b>This is the home page for Version 3 of the Filesystem library.</b></p>
+ <p align="left">Version 3 is a major revision with many new and improved
+ features. It may, however, break some user code written for Version 2.</p>
+ <p align="left">To ease the transition, Boost releases 1.44 through 1.47
+ will supply both V2 and V3. Version 2
+ is the default version for Boost release 1.44
+ and 1.45. Version 3 will be the default starting with release 1.46.</p>
+ <p align="left"><b>Define macro BOOST_FILESYSTEM_VERSION as 3 to use
+ Version 3. This will be the default for release 1.46 and later.</b></p>
+ <p align="left"><b>Define macro BOOST_FILESYSTEM_VERSION as 2 to use
+ Version 2. This is the default for release 1.44 and 1.45.</b></p>
+ <p align="left"><b>You may define the BOOST_FILESYSTEM_VERSION macro:</b></p>
+ <ul>
+ <li>
+ <p align="left"><b>On the build command line; the exact format depends on
+ your compiler or IDE</b></p>
+ </li>
+ <li>
+ <p align="left"><b>In your code, before including any filesystem header,
+ #define BOOST_FILESYSTEM_VERSION <i>n</i></b></p>
+ </li>
+ <li>
+ <p align="left"><b>#define BOOST_FILESYSTEM_VERSION <i>n </i>in boost/config/user.hpp.
+ Note that this approach applies to all uses of Boost.Filesystem.</b></p>
+ </li>
+ </ul>
+ <p align="left">Existing code should be moved to Version 3 as soon as
convenient. New code should be written for Version 3.</p>
- <p align="center">Version 2 is deprecated, and will be removed from Boost
- releases at the end of a transition period.</p>
+ <p align="left">Version 2 is deprecated, and will not be included in Boost
+ releases 1.48 and later.</p>
+ <p align="left"><b>Building the library</b></p>
+ <p align="left">By default, the Boost build system creates libraries that
+ support both version 2 and version 3. To support only a single version,
+ include <code>--disable-filesystem2</code> or <code>--disable-filesystem3</code>
+ on the <code>bjam</code> command line.</p>
</td>
</tr>
</table>
@@ -460,7 +483,7 @@
<hr>
<p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->11 June, 2010<!--webbot bot="Timestamp" endspan i-checksum="19839" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->06 December, 2010<!--webbot bot="Timestamp" endspan i-checksum="38640" --></p>
<p>© Copyright Beman Dawes, 2002-2005</p>
<p> Use, modification, and distribution are subject to the Boost Software
Modified: branches/release/libs/filesystem/v3/doc/reference.html
==============================================================================
--- branches/release/libs/filesystem/v3/doc/reference.html (original)
+++ branches/release/libs/filesystem/v3/doc/reference.html 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -5,7 +5,7 @@
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-<title>Filesystem Reference
+<title>Filesystem V3 Reference
</title>
<link rel="stylesheet" type="text/css" href="../../../../doc/src/minimal.css">
</head>
@@ -98,6 +98,7 @@
  exists<br>
  equivalent<br>
  file_size<br>
+ initial_path<br>
  is_directory<br>
  is_empty<br>
  is_other<br>
@@ -114,6 +115,7 @@
  status_known<br>
  symlink_status<br>
  system_complete<br>
+   temp_directory_path<br>
unique_path</td>
<td width="34%" valign="top">
<a href="#File-streams">File streams</a><br>
@@ -384,7 +386,10 @@
<pre> uintmax_t hard_link_count(const path& p);
uintmax_t hard_link_count(const path& p, system::error_code& ec);
- bool is_directory(file_status s);
+ <span style="background-color: #FFFFFF">const path& initial_path();
+ const path& initial_path(</span><code>system::error_code& ec</code><span style="background-color: #FFFFFF">);
+
+</span> bool is_directory(file_status s);
bool is_directory(const path& p);
bool is_directory(const path& p, system::error_code& ec);
@@ -437,6 +442,9 @@
path system_complete(const path& p);
path system_complete(const path& p, system::error_code& ec);
+ path temp_directory_path();
+ path temp_directory_path(system::error_code& ec);
+
path unique_path(const path& model="%%%%-%%%%-%%%%-%%%%");
path unique_path(const path& model, system::error_code& ec);
@@ -2068,8 +2076,10 @@
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
+<div dir="ltr">
<pre><span style="background-color: #FFFFFF; ">uintmax_t</span> <a name="file_size">file_size</a>(const path& p);<span style="background-color: #FFFFFF; ">
uintmax_t</span> <a name="file_size2">file_size</a>(const path& p, system::error_code& ec);</pre>
+</div>
<blockquote>
<p><span style="background-color: #FFFF00">Remarks: </span></p>
<p><i>Returns:</i> If <code>exists(p) && is_regular_file(p)</code>, the size
@@ -2084,6 +2094,20 @@
<a href="#Error-reporting">
Error reporting</a>.</p>
</blockquote>
+<pre><span style="background-color: #FFFFFF">const path& <a name="initial_path">initial_path</a>();
+const path& <a name="initial_path">initial_path</a>(</span><code>system::error_code& ec</code><span style="background-color: #FFFFFF">);</span></pre>
+<blockquote>
+ <p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF"> </span>
+ <code>current_path()</code> as of the first call to <code>initial_path()</code>.</p>
+ <p>[<i><span style="background-color: #FFFFFF">Note:</span></i> <code>
+ initial_path()</code> is not thread safe, and may return an undesirable result
+ if called subsequent to a change to the current directory. These problems can
+ be avoided by calling <code>initial_path()</code> immediately on entry to
+ main(). <i><span style="background-color: #FFFFFF">--end note</span></i>]</p>
+ <p><i>Throws:</i> For the first call, as specified in
+ <a href="#Error-reporting">
+ Error reporting</a>. Subsequent calls throw nothing.</p>
+</blockquote>
<pre><span style="background-color: #FFFFFF">bool </span><code><span style="background-color: #FFFFFF"><a name="is_directory">is_directory</a></span></code><span style="background-color: #FFFFFF">(file_status s);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF"> </span>
@@ -2442,6 +2466,21 @@
<p>See <a href="#complete_note">
<i>complete()</i> note</a> for usage suggestions. <i>-- end note</i>]</p>
</blockquote>
+<pre>path <a name="temp_directory_path">temp_directory_path</a>();
+path temp_directory_path(system::error_code& ec);</pre>
+<blockquote>
+ <p><i>Returns:</i> A directory path suitable for temporary files under the
+ conventions of the operating system. The specifics of how this path is
+ determined are implementation defined. An error shall be reported if<code> !exists(p)
+ || !is_directory(p)</code>, where <code>p</code> is the path to be returned.</p>
+ <p><i>POSIX:</i> The path supplied by the first environment variable found in the
+ list TMPDIR, TMP, TEMP, TEMPDIR. If none of these are found, <code>"/tmp"</code>.</p>
+ <p><i>Windows:</i> The path reported by the <i>Windows</i> <code>GetTempPath</code> API function.</p>
+ <p><i>Throws:</i> As specified in <a href="#Error-reporting">
+ Error reporting</a>.</p>
+ <p>[<i>Note: </i>The <code>temp_directory_path()</code> name was chosen to emphasize that the return is a
+ path, not just a single directory name. <i>-- end note</i>]</p>
+</blockquote>
<pre>path <a name="unique_path">unique_path</a>(const path& model="%%%%-%%%%-%%%%-%%%%");
path unique_path(const path& model, system::error_code& ec);</pre>
<blockquote>
@@ -3038,7 +3077,8 @@
<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>
+were developed by Vladimir Prus. The temp_directory_path function was
+contributed by Jeff Flinn.</p>
<p>Howard Hinnant and John Maddock reviewed a draft of the version 2 proposal, and
identified a number of mistakes or weaknesses, resulting in a more polished
final document.</p>
@@ -3069,7 +3109,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 -->05 October 2010<!--webbot bot="Timestamp" endspan i-checksum="32123" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->02 January 2011<!--webbot bot="Timestamp" endspan i-checksum="32200" --></p>
</body>
Modified: branches/release/libs/filesystem/v3/src/operations.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/src/operations.cpp (original)
+++ branches/release/libs/filesystem/v3/src/operations.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -49,6 +49,7 @@
#include <boost/scoped_array.hpp>
#include <boost/detail/workaround.hpp>
#include <cstdlib> // for malloc, free
+#include <vector>
#ifdef BOOST_FILEYSTEM_INCLUDE_IOSTREAM
# include <iostream>
@@ -147,6 +148,9 @@
#define REPARSE_DATA_BUFFER_HEADER_SIZE \
FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
+#endif
+
+#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE
#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 )
#endif
@@ -426,8 +430,9 @@
if (::stat(from_p.c_str(), &from_stat)!= 0)
{ return false; }
- int oflag = O_CREAT | O_WRONLY;
- if (fail_if_exists)oflag |= O_EXCL;
+ int oflag = O_CREAT | O_WRONLY | O_TRUNC;
+ if (fail_if_exists)
+ oflag |= O_EXCL;
if ((outfile = ::open(to_p.c_str(), oflag, from_stat.st_mode))< 0)
{
int open_errno = errno;
@@ -1443,6 +1448,9 @@
{
return process_status_failure(p, ec);
}
+
+ if (!is_reparse_point_a_symlink(p))
+ return file_status(reparse_file);
}
if (ec != 0) ec->clear();
@@ -1512,6 +1520,55 @@
# endif
}
+ // contributed by Jeff Flinn
+ BOOST_FILESYSTEM_DECL
+ path temp_directory_path(system::error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+ const char* val = 0;
+
+ (val = std::getenv("TMPDIR" )) ||
+ (val = std::getenv("TMP" )) ||
+ (val = std::getenv("TEMP" )) ||
+ (val = std::getenv("TEMPDIR"));
+
+ path p((val!=0) ? val : "/tmp");
+
+ if (p.empty() || (ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p)))
+ {
+ errno = ENOTDIR;
+ error(true, p, ec, "boost::filesystem::temp_directory_path");
+ return p;
+ }
+
+ return p;
+
+# else // Windows
+
+ std::vector<path::value_type> buf(GetTempPathW(0, NULL));
+
+ if (buf.empty() || GetTempPathW(buf.size(), &buf[0])==0)
+ {
+ if(!buf.empty()) ::SetLastError(ENOTDIR);
+ error(true, ec, "boost::filesystem::temp_directory_path");
+ return path();
+ }
+
+ buf.pop_back();
+
+ path p(buf.begin(), buf.end());
+
+ if ((ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p)))
+ {
+ ::SetLastError(ENOTDIR);
+ error(true, p, ec, "boost::filesystem::temp_directory_path");
+ return path();
+ }
+
+ return p;
+# endif
+ }
+
BOOST_FILESYSTEM_DECL
path system_complete(const path& p, system::error_code* ec)
{
Modified: branches/release/libs/filesystem/v3/src/windows_file_codecvt.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/src/windows_file_codecvt.cpp (original)
+++ branches/release/libs/filesystem/v3/src/windows_file_codecvt.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -31,7 +31,11 @@
#include "windows_file_codecvt.hpp"
-#define WINVER 0x0500 // MinGW for GCC 4.4 requires this
+// Versions of MinGW prior to GCC 4.6 requires this
+#ifndef WINVER
+# define WINVER 0x0500
+#endif
+
#include <windows.h>
std::codecvt_base::result windows_file_codecvt::do_in(
Modified: branches/release/libs/filesystem/v3/test/convenience_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/test/convenience_test.cpp (original)
+++ branches/release/libs/filesystem/v3/test/convenience_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -32,6 +32,7 @@
namespace sys = boost::system;
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
#include <boost/bind.hpp>
#include <fstream>
#include <iostream>
@@ -58,7 +59,7 @@
// ------------------------------------------------------------------------------------//
-int main(int, char*[])
+int cpp_main(int, char*[])
{
// create_directories() tests --------------------------------------------------------//
Modified: branches/release/libs/filesystem/v3/test/deprecated_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/test/deprecated_test.cpp (original)
+++ branches/release/libs/filesystem/v3/test/deprecated_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -23,6 +23,7 @@
#include <boost/filesystem.hpp>
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
namespace fs = boost::filesystem;
using boost::filesystem::path;
@@ -190,7 +191,7 @@
//--------------------------------------------------------------------------------------//
-int main(int /*argc*/, char* /*argv*/[])
+int cpp_main(int /*argc*/, char* /*argv*/[])
{
// The choice of platform is make at runtime rather than compile-time
// so that compile errors for all platforms will be detected even though
Modified: branches/release/libs/filesystem/v3/test/fstream_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/test/fstream_test.cpp (original)
+++ branches/release/libs/filesystem/v3/test/fstream_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -41,6 +41,7 @@
#endif
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
#if defined(_MSC_VER)
# pragma warning(push) // Save warning settings.
@@ -144,7 +145,7 @@
} // test
} // unnamed namespace
-int main(int argc, char*[])
+int cpp_main(int argc, char*[])
{
if (argc > 1) cleanup = false;
Modified: branches/release/libs/filesystem/v3/test/msvc10/filesystem-v3.sln
==============================================================================
--- branches/release/libs/filesystem/v3/test/msvc10/filesystem-v3.sln (original)
+++ branches/release/libs/filesystem/v3/test/msvc10/filesystem-v3.sln 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -29,6 +29,30 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "windows_attributes", "windows_attributes\windows_attributes.vcxproj", "{FC5C770F-3017-4021-8DAF-C5DCA3FDF005}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scratch_test", "scratch_test\scratch_test.vcxproj", "{214D1FDB-CC19-47C6-8DDD-59C5424C6850}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+ {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut5", "tut5\tut5.vcxproj", "{5C9B3380-3C6E-45CC-986A-16D245E27E58}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+ {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut6a", "tut6a\tut6a.vcxproj", "{C781F9C4-31D4-4509-B031-84DB598B207D}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+ {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tut6b", "tut6b\tut6b.vcxproj", "{4A77CA6A-8E72-4CC6-9FE7-2C555C51815C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+ {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -89,6 +113,21 @@
{256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Release|Win32.Build.0 = Release|Win32
{FC5C770F-3017-4021-8DAF-C5DCA3FDF005}.Debug|Win32.ActiveCfg = Debug|Win32
{FC5C770F-3017-4021-8DAF-C5DCA3FDF005}.Release|Win32.ActiveCfg = Release|Win32
+ {214D1FDB-CC19-47C6-8DDD-59C5424C6850}.Debug|Win32.ActiveCfg = Release|Win32
+ {214D1FDB-CC19-47C6-8DDD-59C5424C6850}.Release|Win32.ActiveCfg = Release|Win32
+ {214D1FDB-CC19-47C6-8DDD-59C5424C6850}.Release|Win32.Build.0 = Release|Win32
+ {5C9B3380-3C6E-45CC-986A-16D245E27E58}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5C9B3380-3C6E-45CC-986A-16D245E27E58}.Debug|Win32.Build.0 = Debug|Win32
+ {5C9B3380-3C6E-45CC-986A-16D245E27E58}.Release|Win32.ActiveCfg = Release|Win32
+ {5C9B3380-3C6E-45CC-986A-16D245E27E58}.Release|Win32.Build.0 = Release|Win32
+ {C781F9C4-31D4-4509-B031-84DB598B207D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C781F9C4-31D4-4509-B031-84DB598B207D}.Debug|Win32.Build.0 = Debug|Win32
+ {C781F9C4-31D4-4509-B031-84DB598B207D}.Release|Win32.ActiveCfg = Release|Win32
+ {C781F9C4-31D4-4509-B031-84DB598B207D}.Release|Win32.Build.0 = Release|Win32
+ {4A77CA6A-8E72-4CC6-9FE7-2C555C51815C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4A77CA6A-8E72-4CC6-9FE7-2C555C51815C}.Debug|Win32.Build.0 = Debug|Win32
+ {4A77CA6A-8E72-4CC6-9FE7-2C555C51815C}.Release|Win32.ActiveCfg = Release|Win32
+ {4A77CA6A-8E72-4CC6-9FE7-2C555C51815C}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: branches/release/libs/filesystem/v3/test/msvc10/windows_attributes/windows_attributes.vcxproj
==============================================================================
--- branches/release/libs/filesystem/v3/test/msvc10/windows_attributes/windows_attributes.vcxproj (original)
+++ branches/release/libs/filesystem/v3/test/msvc10/windows_attributes/windows_attributes.vcxproj 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -32,9 +32,11 @@
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\common.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\common.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -76,6 +78,14 @@
<ItemGroup>
<ClCompile Include="..\..\windows_attributes.cpp" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj">
+ <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\system_dll\system_dll.vcxproj">
+ <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Modified: branches/release/libs/filesystem/v3/test/operations_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/test/operations_test.cpp (original)
+++ branches/release/libs/filesystem/v3/test/operations_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -30,6 +30,7 @@
namespace fs = boost::filesystem;
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
using boost::system::error_code;
using boost::system::system_category;
@@ -46,12 +47,35 @@
#ifdef BOOST_WINDOWS_API
# include <windows.h>
+
+inline std::wstring convert(const char* c)
+{
+ std::string s(c);
+
+ return std::wstring(s.begin(), s.end());
+}
+
+inline int setenv(const char* name, const fs::path::value_type* val, int)
+{
+ return SetEnvironmentVariableW(convert(name).c_str(), val);
+}
+
+inline int setenv(const char* name, const char* val, int)
+{
+ return SetEnvironmentVariableW(convert(name).c_str(), convert(val).c_str());
+}
+
+inline int unsetenv(const char* name)
+{
+ return SetEnvironmentVariableW(convert(name).c_str(), 0);
+}
+
#endif
// on Windows, except for standard libaries known to have wchar_t overloads for
// file stream I/O, use path::string() to get a narrow character c_str()
#if defined(BOOST_WINDOWS_API) \
- && !(defined(_CPPLIB_VER) && _CPPLIB_VER >= 405) // not (Dinkumware with overloads)
+ && (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405) // not Dinkumware || no wide overloads
# define BOOST_FILESYSTEM_C_STR string().c_str() // use narrow, since wide not available
#else // use the native c_str, which will be narrow on POSIX, wide on Windows
# define BOOST_FILESYSTEM_C_STR c_str()
@@ -65,7 +89,6 @@
std::string platform(BOOST_PLATFORM);
bool report_throws;
bool cleanup = true;
- fs::path init_path(fs::current_path());
fs::directory_iterator end_itr;
fs::path dir;
fs::path d1;
@@ -608,7 +631,7 @@
BOOST_TEST(fs::is_symlink(from_ph));
BOOST_TEST(fs::exists(f1));
BOOST_TEST(fs::equivalent(from_ph, f1));
- BOOST_TEST(fs::read_symlink(from_ph) == f1);
+ BOOST_TEST(fs::read_symlink(from_ph) == f1);
fs::file_status stat = fs::symlink_status(from_ph);
BOOST_TEST(fs::exists(stat));
@@ -624,9 +647,9 @@
BOOST_TEST(!fs::is_other(stat));
BOOST_TEST(!fs::is_symlink(stat));
- // since create_symlink worked, copy_symlink should also work
+ // since create_symlink worked, copy_symlink should also work
fs::path symlink2_ph(dir / "symlink2");
- fs::copy_symlink(from_ph, symlink2_ph);
+ fs::copy_symlink(from_ph, symlink2_ph);
stat = fs::symlink_status(symlink2_ph);
BOOST_TEST(fs::is_symlink(stat));
BOOST_TEST(fs::exists(stat));
@@ -1163,10 +1186,14 @@
catch (const fs::filesystem_error &) { copy_ex_ok = true; }
BOOST_TEST(copy_ex_ok);
+ create_file(d1 / "f2", "1234567890");
+ BOOST_TEST_EQ(fs::file_size(d1 / "f2"), 10U);
copy_ex_ok = true;
try { fs::copy_file(f1, d1 / "f2", fs::copy_option::overwrite_if_exists); }
catch (const fs::filesystem_error &) { copy_ex_ok = false; }
BOOST_TEST(copy_ex_ok);
+ BOOST_TEST_EQ(fs::file_size(d1 / "f2"), 7U);
+ verify_file(d1 / "f2", "file-f1");
}
// symlink_status_tests -------------------------------------------------------------//
@@ -1324,20 +1351,20 @@
&& dir.string()[1] == ':'); // verify path includes drive
BOOST_TEST(fs::system_complete("").empty());
- BOOST_TEST(fs::system_complete("/") == init_path.root_path());
+ BOOST_TEST(fs::system_complete("/") == fs::initial_path().root_path());
BOOST_TEST(fs::system_complete("foo")
- == init_path / "foo");
+ == fs::initial_path() / "foo");
fs::path p1(fs::system_complete("/foo"));
BOOST_TEST_EQ(p1.string().size(), 6U); // this failed during v3 development due to bug
std::string s1(p1.string() );
- std::string s2(init_path.root_path().string()+"foo");
+ std::string s2(fs::initial_path().root_path().string()+"foo");
BOOST_TEST_EQ(s1, s2);
- BOOST_TEST(fs::system_complete(fs::path(init_path.root_name()))
- == init_path);
- BOOST_TEST(fs::system_complete(fs::path(init_path.root_name().string()
- + "foo")).string() == init_path / "foo");
+ BOOST_TEST(fs::system_complete(fs::path(fs::initial_path().root_name()))
+ == fs::initial_path());
+ BOOST_TEST(fs::system_complete(fs::path(fs::initial_path().root_name().string()
+ + "foo")).string() == fs::initial_path() / "foo");
BOOST_TEST(fs::system_complete(fs::path("c:/")).generic_string()
== "c:/");
BOOST_TEST(fs::system_complete(fs::path("c:/foo")).generic_string()
@@ -1350,12 +1377,12 @@
{
std::cout << "POSIX specific tests..." << std::endl;
BOOST_TEST(fs::system_complete("").empty());
- BOOST_TEST(init_path.root_path().string() == "/");
+ BOOST_TEST(fs::initial_path().root_path().string() == "/");
BOOST_TEST(fs::system_complete("/").string() == "/");
BOOST_TEST(fs::system_complete("foo").string()
- == init_path.string()+"/foo");
+ == fs::initial_path().string()+"/foo");
BOOST_TEST(fs::system_complete("/foo").string()
- == init_path.root_path().string()+"foo");
+ == fs::initial_path().root_path().string()+"foo");
} // POSIX
}
@@ -1366,11 +1393,12 @@
std::cout << "initial_tests..." << std::endl;
std::cout << " current_path().string() is\n \""
- << init_path.string()
+ << fs::initial_path().string()
<< "\"\n\n";
- BOOST_TEST(init_path.is_absolute());
+ BOOST_TEST(fs::initial_path() == fs::current_path());
+ BOOST_TEST(fs::initial_path().is_absolute());
BOOST_TEST(fs::current_path().is_absolute());
- BOOST_TEST(init_path.string()
+ BOOST_TEST(fs::initial_path().string()
== fs::current_path().string());
}
@@ -1413,6 +1441,172 @@
BOOST_TEST(!fs::equivalent(ng, f1));
}
+ // temp_directory_path_tests -------------------------------------------------------//
+ // contributed by Jeff Flinn
+
+ struct guarded_env_var
+ {
+ struct previous_value
+ {
+ std::string m_name;
+ std::string m_string;
+ bool m_empty;
+
+ previous_value(const char* name)
+ : m_string(name)
+ , m_empty (true)
+ {
+ if(const char* value = getenv(name))
+ {
+ m_string.assign(value);
+ m_empty = false;
+ }
+ else
+ {
+ m_empty = true;
+ }
+ }
+ ~previous_value()
+ {
+ m_empty? unsetenv(m_name.c_str())
+ : setenv(m_name.c_str(), m_string.c_str(), 1);
+ }
+ };
+
+ previous_value m_previous_value;
+
+ guarded_env_var(const char* name, const fs::path::value_type* value)
+ : m_previous_value(name)
+ {
+ value? setenv(name, value, 1) : unsetenv(name);
+ }
+ };
+
+ void temp_directory_path_tests()
+ {
+ {
+ std::cout << "temp_directory_path_tests..." << std::endl;
+
+ BOOST_TEST(!fs::temp_directory_path().empty());
+ BOOST_TEST(exists(fs::temp_directory_path()));
+ fs::path ph = fs::temp_directory_path()/"temp_directory_path_test.txt";
+ {
+ if(exists(ph)) remove(ph);
+ std::ofstream f(ph.BOOST_FILESYSTEM_C_STR);
+ f << "passed";
+ }
+ BOOST_TEST(exists(ph));
+ {
+ std::ifstream f(ph.BOOST_FILESYSTEM_C_STR);
+ std::string s;
+ f >> s;
+ BOOST_TEST(s == "passed");
+ }
+ remove(ph);
+ BOOST_TEST(!exists(ph));
+ }
+
+ fs::path test_temp_dir = fs::initial_path();
+
+#if defined BOOST_POSIX_API
+ {
+ struct guarded_tmp_vars
+ {
+ guarded_env_var m_tmpdir ;
+ guarded_env_var m_tmp ;
+ guarded_env_var m_temp ;
+ guarded_env_var m_tempdir;
+
+ guarded_tmp_vars
+ ( const fs::path::value_type* tmpdir
+ , const fs::path::value_type* tmp
+ , const fs::path::value_type* temp
+ , const fs::path::value_type* tempdir
+ )
+ : m_tmpdir ("TMPDIR" , tmpdir )
+ , m_tmp ("TMP" , tmp )
+ , m_temp ("TEMP" , temp )
+ , m_tempdir("TEMPDIR", tempdir)
+ {}
+ };
+
+ {
+ guarded_tmp_vars vars(test_temp_dir.c_str(), 0, 0, 0);
+ fs::path ph = fs::temp_directory_path();
+ BOOST_TEST(equivalent(test_temp_dir, ph));
+ }
+ {
+ guarded_tmp_vars vars(0, test_temp_dir.c_str(), 0, 0);
+ fs::path ph = fs::temp_directory_path();
+ BOOST_TEST(equivalent(test_temp_dir, ph));
+ }
+ {
+ guarded_tmp_vars vars(0, 0, test_temp_dir.c_str(), 0);
+ fs::path ph = fs::temp_directory_path();
+ BOOST_TEST(equivalent(test_temp_dir, ph));
+ }
+ {
+ guarded_tmp_vars vars(0, 0, 0, test_temp_dir.c_str());
+ fs::path ph = fs::temp_directory_path();
+ BOOST_TEST(equivalent(test_temp_dir, ph));
+ }
+ }
+#endif
+
+#if defined BOOST_WINDOWS_API
+ {
+ struct guarded_tmp_vars
+ {
+ guarded_env_var m_tmp ;
+ guarded_env_var m_temp ;
+ guarded_env_var m_userprofile;
+
+ guarded_tmp_vars
+ ( const fs::path::value_type* tmp
+ , const fs::path::value_type* temp
+ , const fs::path::value_type* userprofile
+ )
+ : m_tmp ("TMP" , tmp )
+ , m_temp ("TEMP" , temp )
+ , m_userprofile("USERPROFILE", userprofile)
+ {}
+ };
+
+ // should NEVER throw - the windows directory or current_path always exists
+ {
+ guarded_tmp_vars vars(0, 0, 0);
+ fs::path ph = fs::temp_directory_path();
+
+ BOOST_TEST(test_temp_dir != ph);
+ }
+
+ // should NEVER fail - the windows directory or current_path always exists
+ {
+ guarded_tmp_vars vars(0, 0, 0);
+ error_code ec;
+ fs::path ph = fs::temp_directory_path(ec);
+ BOOST_TEST(!ec);
+ }
+
+ {
+ guarded_tmp_vars vars(test_temp_dir.c_str(), 0, 0);
+ fs::path ph = fs::temp_directory_path();
+ BOOST_TEST(equivalent(test_temp_dir, ph));
+ }
+ {
+ guarded_tmp_vars vars(0, test_temp_dir.c_str(), 0);
+ fs::path ph = fs::temp_directory_path();
+ BOOST_TEST(equivalent(test_temp_dir, ph));
+ }
+ {
+ guarded_tmp_vars vars(0, 0, test_temp_dir.c_str());
+ fs::path ph = fs::temp_directory_path();
+ BOOST_TEST(equivalent(test_temp_dir, ph));
+ }
+ }
+#endif
+ }
+
// _tests --------------------------------------------------------------------------//
void _tests()
@@ -1428,7 +1622,7 @@
// //
//------------------------------------------------------------------------------------//
-int main(int argc, char* argv[])
+int cpp_main(int argc, char* argv[])
{
// document state of critical macros
#ifdef BOOST_POSIX_API
@@ -1458,7 +1652,7 @@
# endif
std::cout << "API is " << platform << std::endl;
- dir = init_path / temp_dir_name;
+ dir = fs::initial_path() / temp_dir_name;
if (fs::exists(dir))
{
@@ -1520,7 +1714,9 @@
if (create_symlink_ok) // only if symlinks supported
remove_symlink_tests();
write_time_tests(dir);
-
+
+ temp_directory_path_tests();
+
std::cout << "testing complete" << std::endl;
// post-test cleanup
Modified: branches/release/libs/filesystem/v3/test/operations_unit_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/test/operations_unit_test.cpp (original)
+++ branches/release/libs/filesystem/v3/test/operations_unit_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -34,6 +34,7 @@
#include <boost/filesystem.hpp> // make sure filesystem.hpp works
#include <boost/system/error_code.hpp>
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
#include <iostream>
using namespace boost::filesystem;
@@ -214,7 +215,7 @@
// //
//--------------------------------------------------------------------------------------//
-int main()
+int cpp_main(int, char*[])
{
// document state of critical macros
#ifdef BOOST_POSIX_API
Modified: branches/release/libs/filesystem/v3/test/path_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/test/path_test.cpp (original)
+++ branches/release/libs/filesystem/v3/test/path_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -44,6 +44,7 @@
using boost::filesystem::path;
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
#define PATH_CHECK(a, b) check(a, b, __FILE__, __LINE__)
#define CHECK_EQUAL(a,b) check_equal(a, b, __FILE__, __LINE__)
@@ -1575,7 +1576,7 @@
// //
//--------------------------------------------------------------------------------------//
-int main(int, char*[])
+int cpp_main(int, char*[])
{
// The choice of platform is make at runtime rather than compile-time
// so that compile errors for all platforms will be detected even though
Modified: branches/release/libs/filesystem/v3/test/path_unit_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/test/path_unit_test.cpp (original)
+++ branches/release/libs/filesystem/v3/test/path_unit_test.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -41,6 +41,7 @@
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp> // for imbue tests
#include "test_codecvt.hpp" // for codecvt arg tests
#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
#include <boost/smart_ptr.hpp> // used constructor tests
#include <iostream>
@@ -105,13 +106,13 @@
++::boost::detail::test_errors();
- std::cout << file << '(' << line << "): native() is not equal expected\n"
+ std::cout << file << '(' << line << "): native() is not equal expected\n"
" native---: " << std::hex;
- path::string_type nat(p.native());
- for (path::string_type::const_iterator it = nat.begin(); it != nat.end(); ++it)
+ path::string_type nat(p.native());
+ for (path::string_type::const_iterator it = nat.begin(); it != nat.end(); ++it)
std::cout << long(*it) << ' ';
std::cout << "\n expected-: ";
- for (path::string_type::const_iterator it = expected.begin(); it != expected.end(); ++it)
+ for (path::string_type::const_iterator it = expected.begin(); it != expected.end(); ++it)
std::cout << long(*it) << ' ';
std::cout << std::dec << std::endl;
}
@@ -681,22 +682,22 @@
test_codecvt cvt; // produces off-by-one values that will always differ from
// the system's default locale codecvt facet
- int t = 0;
+ int t = 0;
// constructors
- std::cout << " constructors test " << ++t << std::endl;
+ std::cout << " constructors test " << ++t << std::endl;
path p(c1, cvt);
NATIVE_IS(p, s1, ws1);
- std::cout << " test " << ++t << std::endl;
+ std::cout << " test " << ++t << std::endl;
path p1(s1.begin(), s1.end(), cvt);
NATIVE_IS(p1, s1, ws1);
- std::cout << " test " << ++t << std::endl;
+ std::cout << " test " << ++t << std::endl;
path p2(ws2, cvt);
NATIVE_IS(p2, s2, ws2);
- std::cout << " test " << ++t << std::endl;
+ std::cout << " test " << ++t << std::endl;
path p3(ws2.begin(), ws2.end(), cvt);
NATIVE_IS(p3, s2, ws2);
@@ -704,44 +705,44 @@
// assigns
p1.clear();
- std::cout << " assigns test " << ++t << std::endl;
+ std::cout << " assigns test " << ++t << std::endl;
p1.assign(s1,cvt);
NATIVE_IS(p1, s1, ws1);
p1.clear();
- std::cout << " test " << ++t << std::endl;
+ std::cout << " test " << ++t << std::endl;
p1.assign(s1.begin(), s1.end(), cvt);
NATIVE_IS(p1, s1, ws1);
// p1.assign(p, cvt); // fails to compile, and that is OK
// appends
p1.clear();
- std::cout << " appends test " << ++t << std::endl;
+ std::cout << " appends test " << ++t << std::endl;
p1.append(s1,cvt);
NATIVE_IS(p1, s1, ws1);
p1.clear();
- std::cout << " test " << ++t << std::endl;
+ std::cout << " test " << ++t << std::endl;
p1.append(s1.begin(), s1.end(), cvt);
NATIVE_IS(p1, s1, ws1);
// p1.append(p, cvt); // fails to compile, and that is OK
// native observers
- std::cout << " native observers test " << ++t << std::endl;
+ std::cout << " native observers test " << ++t << std::endl;
CHECK(p.string<std::string>(cvt) == s1);
- std::cout << " test " << ++t << std::endl;
+ std::cout << " test " << ++t << std::endl;
CHECK(p.string(cvt) == s1);
- std::cout << " test " << ++t << std::endl;
+ std::cout << " test " << ++t << std::endl;
CHECK(p.string<std::wstring>(cvt) == ws1);
- std::cout << " test " << ++t << std::endl;
+ std::cout << " test " << ++t << std::endl;
CHECK(p.wstring(cvt) == ws1);
// generic observers
- std::cout << " generic observers test " << ++t << std::endl;
+ std::cout << " generic observers test " << ++t << std::endl;
CHECK(p.generic_string<std::string>(cvt) == s1);
- std::cout << " test " << ++t << std::endl;
+ std::cout << " test " << ++t << std::endl;
CHECK(p.generic_string(cvt) == s1);
- std::cout << " test " << ++t << std::endl;
+ std::cout << " test " << ++t << std::endl;
CHECK(p.generic_string<std::wstring>(cvt) == ws1);
- std::cout << " test " << ++t << std::endl;
+ std::cout << " test " << ++t << std::endl;
CHECK(p.generic_wstring(cvt) == ws1);
std::cout << " codecvt arguments testing complete" << std::endl;
@@ -963,7 +964,7 @@
// //
//--------------------------------------------------------------------------------------//
-int main(int, char*[])
+int cpp_main(int, char*[])
{
// document state of critical macros
#ifdef BOOST_POSIX_API
Modified: branches/release/libs/filesystem/v3/test/windows_attributes.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/test/windows_attributes.cpp (original)
+++ branches/release/libs/filesystem/v3/test/windows_attributes.cpp 2011-01-11 16:39:33 EST (Tue, 11 Jan 2011)
@@ -13,6 +13,8 @@
//--------------------------------------------------------------------------------------//
+#include <boost/filesystem.hpp>
+#include <boost/detail/lightweight_main.hpp>
#include <windows.h>
#include <map>
#include <utility>
@@ -20,8 +22,9 @@
#include <string>
using std::make_pair;
+namespace fs = boost::filesystem;
-int main( int argc, char* argv[])
+int cpp_main( int argc, char* argv[])
{
typedef std::map<DWORD, std::string> decode_type;
decode_type table;
@@ -47,6 +50,8 @@
return 1;
}
+ // report Win32 ::GetFileAttributesA()
+
DWORD at(::GetFileAttributesA(argv[1]));
if (at == INVALID_FILE_ATTRIBUTES)
{
@@ -72,7 +77,32 @@
std::cout << std::endl;
if (at)
- std::cout << "plus unknown attributes " << at << std::endl;
+ std::cout << "plus unknown attributes " << at << std::endl;
+
+ // report Boost Filesystem file_type
+
+ fs::file_status stat = fs::status(argv[1]);
+
+ const char* types[] =
+ {
+ "status_error",
+ "file_not_found",
+ "regular_file",
+ "directory_file",
+ // the following may not apply to some operating systems or file systems
+ "symlink_file",
+ "block_file",
+ "character_file",
+ "fifo_file",
+ "socket_file",
+ "reparse_file", // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink
+ "type_unknown", // file does exist", but isn't one of the above types or
+ // we don't have strong enough permission to find its type
+
+ "_detail_directory_symlink" // internal use only; never exposed to users
+ };
+
+ std::cout << "boost::filesystem::status().type() is " << types[stat.type()] << std::endl;
return 0;
}
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