|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49162 - trunk/tools/bcp
From: john_at_[hidden]
Date: 2008-10-07 05:29:04
Author: johnmaddock
Date: 2008-10-07 05:29:03 EDT (Tue, 07 Oct 2008)
New Revision: 49162
URL: http://svn.boost.org/trac/boost/changeset/49162
Log:
Fixes #2386. Removed trailing / from boost path.
Fixes #2385. Handles all positional args separately from named args.
Text files modified:
trunk/tools/bcp/bcp_imp.cpp | 10 +++++++++-
trunk/tools/bcp/main.cpp | 19 +++++++++++++++----
2 files changed, 24 insertions(+), 5 deletions(-)
Modified: trunk/tools/bcp/bcp_imp.cpp
==============================================================================
--- trunk/tools/bcp/bcp_imp.cpp (original)
+++ trunk/tools/bcp/bcp_imp.cpp 2008-10-07 05:29:03 EDT (Tue, 07 Oct 2008)
@@ -78,7 +78,8 @@
void bcp_implementation::set_boost_path(const char* p)
{
- m_boost_path = fs::path(p, fs::native);
+ // Hack to strip trailing slashes from the path
+ m_boost_path = (fs::path(p, fs::native) / "boost").parent_path();
fs::path check = m_boost_path / "boost" / "version.hpp";
if(!fs::exists(check))
{
@@ -125,6 +126,13 @@
std::runtime_error e(msg);
boost::throw_exception(e);
}
+ //
+ // Check Boost path is OK if it hasn't been checked already:
+ //
+ if(m_boost_path == "")
+ {
+ set_boost_path("");
+ }
// start by building a list of permitted files
// if m_cvs_mode is true:
if(m_cvs_mode)
Modified: trunk/tools/bcp/main.cpp
==============================================================================
--- trunk/tools/bcp/main.cpp (original)
+++ trunk/tools/bcp/main.cpp 2008-10-07 05:29:03 EDT (Tue, 07 Oct 2008)
@@ -11,6 +11,8 @@
#include <iostream>
#include <cstring>
+#include <string>
+#include <list>
#include <boost/filesystem/path.hpp>
#include <boost/version.hpp>
#include "bcp.hpp"
@@ -74,6 +76,7 @@
// object what ir needs to do:
//
bool list_mode = false;
+ std::list<const char*> positional_args;
for(int i = 1; i < argc; ++i)
{
if(0 == std::strcmp("-h", argv[i])
@@ -138,13 +141,21 @@
}
else
{
- if(!list_mode && (i == argc - 1))
- papp->set_destination(argv[i]);
- else
- papp->add_module(argv[i]);
+ positional_args.push_back(argv[i]);
}
}
//
+ // Handle positional args last:
+ //
+ for(std::list<const char*>::const_iterator i = positional_args.begin();
+ i != positional_args.end(); ++i)
+ {
+ if(!list_mode && (i == --positional_args.end()))
+ papp->set_destination(*i);
+ else
+ papp->add_module(*i);
+ }
+ //
// run the application object:
//
return papp->run();
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