|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67486 - trunk/tools/bcp
From: john_at_[hidden]
Date: 2010-12-29 07:56:52
Author: johnmaddock
Date: 2010-12-29 07:56:46 EST (Wed, 29 Dec 2010)
New Revision: 67486
URL: http://svn.boost.org/trac/boost/changeset/67486
Log:
Bring bcp up to date with filesystem V3.
Text files modified:
trunk/tools/bcp/add_path.cpp | 2 +-
trunk/tools/bcp/bcp.hpp | 6 ++++++
trunk/tools/bcp/bcp_imp.cpp | 17 +++++------------
trunk/tools/bcp/copy_path.cpp | 22 +++++++++++-----------
trunk/tools/bcp/file_types.cpp | 8 ++++----
trunk/tools/bcp/fileview.cpp | 4 ++--
trunk/tools/bcp/fileview.hpp | 6 ++++++
trunk/tools/bcp/main.cpp | 6 +++---
trunk/tools/bcp/output_licence_info.cpp | 2 +-
trunk/tools/bcp/scan_licence.cpp | 4 ++--
10 files changed, 41 insertions(+), 36 deletions(-)
Modified: trunk/tools/bcp/add_path.cpp
==============================================================================
--- trunk/tools/bcp/add_path.cpp (original)
+++ trunk/tools/bcp/add_path.cpp 2010-12-29 07:56:46 EST (Wed, 29 Dec 2010)
@@ -68,7 +68,7 @@
// we need to convert *i back into
// a relative path, what follows is a hack:
//
- std::string s(i->string());
+ std::string s(i->path().string());
if(m_boost_path.string().size())
s.erase(0, m_boost_path.string().size() + 1);
fs::path np = s;
Modified: trunk/tools/bcp/bcp.hpp
==============================================================================
--- trunk/tools/bcp/bcp.hpp (original)
+++ trunk/tools/bcp/bcp.hpp 2010-12-29 07:56:46 EST (Wed, 29 Dec 2010)
@@ -9,6 +9,12 @@
#include <boost/shared_ptr.hpp>
+#if defined(BOOST_FILESYSTEM_VERSION) && (BOOST_FILESYSTEM_VERSION != 3)
+# error "This library must be built with Boost.Filesystem version 3"
+#else
+#define BOOST_FILESYSTEM_VERSION 3
+#endif
+
class bcp_application;
typedef boost::shared_ptr<bcp_application> pbcp_application;
Modified: trunk/tools/bcp/bcp_imp.cpp
==============================================================================
--- trunk/tools/bcp/bcp_imp.cpp (original)
+++ trunk/tools/bcp/bcp_imp.cpp 2010-12-29 07:56:46 EST (Wed, 29 Dec 2010)
@@ -81,7 +81,7 @@
void bcp_implementation::set_boost_path(const char* p)
{
// Hack to strip trailing slashes from the path
- m_boost_path = (fs::path(p, fs::native) / "boost").parent_path();
+ m_boost_path = (fs::path(p) / "boost").parent_path();
fs::path check = m_boost_path / "boost" / "version.hpp";
if(!fs::exists(check))
{
@@ -94,7 +94,7 @@
void bcp_implementation::set_destination(const char* p)
{
- m_dest_path = fs::path(p, fs::native);
+ m_dest_path = fs::path(p);
}
void bcp_implementation::add_module(const char* p)
@@ -140,7 +140,7 @@
if(!m_list_mode && !m_license_mode && !fs::exists(m_dest_path))
{
std::string msg("Destination path does not exist: ");
- msg.append(m_dest_path.native_file_string());
+ msg.append(m_dest_path.string());
std::runtime_error e(msg);
boost::throw_exception(e);
}
@@ -190,15 +190,8 @@
//
fs::path module;
fs::path exmodule;
- try{
- module = fs::path(*i);
- exmodule = fs::path(*i + ".hpp");
- }
- catch(...)
- {
- module = fs::path(*i, fs::native);
- exmodule = fs::path(*i + ".hpp", fs::native);
- }
+ module = fs::path(*i);
+ exmodule = fs::path(*i + ".hpp");
if(m_scan_mode)
{
Modified: trunk/tools/bcp/copy_path.cpp
==============================================================================
--- trunk/tools/bcp/copy_path.cpp (original)
+++ trunk/tools/bcp/copy_path.cpp 2010-12-29 07:56:46 EST (Wed, 29 Dec 2010)
@@ -63,7 +63,7 @@
static std::vector<char> v1, v2;
v1.clear();
v2.clear();
- std::ifstream is((m_boost_path / p).native_file_string().c_str());
+ std::ifstream is((m_boost_path / p).string().c_str());
std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1));
static boost::regex libname_matcher;
@@ -78,9 +78,9 @@
std::ofstream os;
if(m_unix_lines)
- os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::binary | std::ios_base::out);
+ os.open((m_dest_path / p).string().c_str(), std::ios_base::binary | std::ios_base::out);
else
- os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::out);
+ os.open((m_dest_path / p).string().c_str(), std::ios_base::out);
os.write(&*v1.begin(), v1.size());
os.close();
}
@@ -89,7 +89,7 @@
static std::vector<char> v1, v2;
v1.clear();
v2.clear();
- std::ifstream is((m_boost_path / p).native_file_string().c_str());
+ std::ifstream is((m_boost_path / p).string().c_str());
std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1));
static boost::regex libname_matcher;
@@ -111,9 +111,9 @@
std::ofstream os;
if(m_unix_lines)
- os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::binary | std::ios_base::out);
+ os.open((m_dest_path / p).string().c_str(), std::ios_base::binary | std::ios_base::out);
else
- os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::out);
+ os.open((m_dest_path / p).string().c_str(), std::ios_base::out);
os.write(&*v1.begin(), v1.size());
os.close();
}
@@ -127,7 +127,7 @@
static std::vector<char> v1, v2;
v1.clear();
v2.clear();
- std::ifstream is((m_boost_path / p).native_file_string().c_str());
+ std::ifstream is((m_boost_path / p).string().c_str());
std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1));
static const boost::regex namespace_matcher(
@@ -202,20 +202,20 @@
std::ofstream os;
if(m_unix_lines)
- os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::binary | std::ios_base::out);
+ os.open((m_dest_path / p).string().c_str(), std::ios_base::binary | std::ios_base::out);
else
- os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::out);
+ os.open((m_dest_path / p).string().c_str(), std::ios_base::out);
if(v1.size())
os.write(&*v1.begin(), v1.size());
os.close();
}
else if(m_unix_lines && !is_binary_file(p))
{
- std::ifstream is((m_boost_path / p).native_file_string().c_str());
+ std::ifstream is((m_boost_path / p).string().c_str());
std::istreambuf_iterator<char> isi(is);
std::istreambuf_iterator<char> end;
- std::ofstream os((m_dest_path / p).native_file_string().c_str(), std::ios_base::binary | std::ios_base::out);
+ std::ofstream os((m_dest_path / p).string().c_str(), std::ios_base::binary | std::ios_base::out);
std::ostreambuf_iterator<char> osi(os);
std::copy(isi, end, osi);
Modified: trunk/tools/bcp/file_types.cpp
==============================================================================
--- trunk/tools/bcp/file_types.cpp (original)
+++ trunk/tools/bcp/file_types.cpp 2010-12-29 07:56:46 EST (Wed, 29 Dec 2010)
@@ -23,7 +23,7 @@
")",
boost::regex::perl | boost::regex::icase
);
- return boost::regex_match(p.filename(), e);
+ return boost::regex_match(p.filename().string(), e);
}
bool bcp_implementation::is_html_file(const fs::path& p)
@@ -34,7 +34,7 @@
"html?|css"
")"
);
- return boost::regex_match(p.filename(), e);
+ return boost::regex_match(p.filename().string(), e);
}
bool bcp_implementation::is_binary_file(const fs::path& p)
@@ -52,7 +52,7 @@
"|"
"(Jamfile|makefile|configure)",
boost::regex::perl | boost::regex::icase);
- return !boost::regex_match(p.leaf(), e);
+ return !boost::regex_match(p.leaf().string(), e);
}
@@ -67,6 +67,6 @@
"(Jamfile|Jamroot)\\.?",
boost::regex::perl | boost::regex::icase
);
- return boost::regex_match(p.filename(), e);
+ return boost::regex_match(p.filename().string(), e);
}
Modified: trunk/tools/bcp/fileview.cpp
==============================================================================
--- trunk/tools/bcp/fileview.cpp (original)
+++ trunk/tools/bcp/fileview.cpp 2010-12-29 07:56:46 EST (Wed, 29 Dec 2010)
@@ -57,11 +57,11 @@
void fileview::open(const boost::filesystem::path& p)
{
cow();
- std::ifstream is(p.native_file_string().c_str());
+ std::ifstream is(p.string().c_str());
if(!is)
{
std::string msg("Bad file name: ");
- msg += p.native_file_string();
+ msg += p.string();
std::runtime_error e(msg);
boost::throw_exception(e);
}
Modified: trunk/tools/bcp/fileview.hpp
==============================================================================
--- trunk/tools/bcp/fileview.hpp (original)
+++ trunk/tools/bcp/fileview.hpp 2010-12-29 07:56:46 EST (Wed, 29 Dec 2010)
@@ -7,6 +7,12 @@
*
*/
+#if defined(BOOST_FILESYSTEM_VERSION) && (BOOST_FILESYSTEM_VERSION != 3)
+# error "This library must be built with Boost.Filesystem version 3"
+#else
+#define BOOST_FILESYSTEM_VERSION 3
+#endif
+
#include <boost/shared_ptr.hpp>
#include <boost/filesystem/path.hpp>
Modified: trunk/tools/bcp/main.cpp
==============================================================================
--- trunk/tools/bcp/main.cpp (original)
+++ trunk/tools/bcp/main.cpp 2010-12-29 07:56:46 EST (Wed, 29 Dec 2010)
@@ -13,9 +13,9 @@
#include <cstring>
#include <string>
#include <list>
+#include "bcp.hpp"
#include <boost/filesystem/path.hpp>
#include <boost/version.hpp>
-#include "bcp.hpp"
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std{
@@ -60,7 +60,7 @@
// with files that already exist, if they're not portable
// names it's too late for us to do anything about it).
//
- boost::filesystem::path::default_name_check(filesystem_name_check);
+ /*boost::filesystem::path::default_name_check(filesystem_name_check);*/
//
// without arguments just show help:
//
@@ -68,7 +68,7 @@
{
std::cout << "Error: insufficient arguments, don't know what to do." << std::endl;
show_usage();
- return 0;
+ return 1;
}
//
// create the application object:
Modified: trunk/tools/bcp/output_licence_info.cpp
==============================================================================
--- trunk/tools/bcp/output_licence_info.cpp (original)
+++ trunk/tools/bcp/output_licence_info.cpp 2010-12-29 07:56:46 EST (Wed, 29 Dec 2010)
@@ -57,7 +57,7 @@
i = m_license_data.begin();
j = m_license_data.end();
- std::ofstream os(m_dest_path.native_file_string().c_str());
+ std::ofstream os(m_dest_path.string().c_str());
if(!os)
{
std::string msg("Error opening ");
Modified: trunk/tools/bcp/scan_licence.cpp
==============================================================================
--- trunk/tools/bcp/scan_licence.cpp (original)
+++ trunk/tools/bcp/scan_licence.cpp 2010-12-29 07:56:46 EST (Wed, 29 Dec 2010)
@@ -239,10 +239,10 @@
// Perform the actual conversion
if (m_bsl_convert_mode) {
try{
- std::ofstream out((m_boost_path / p).native_file_string().c_str());
+ std::ofstream out((m_boost_path / p).string().c_str());
if (!out) {
std::string msg("Cannot open file for license conversion: ");
- msg += p.native_file_string();
+ msg += p.string();
std::runtime_error e(msg);
boost::throw_exception(e);
}
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