mirror of
https://github.com/boostorg/quickbook.git
synced 2026-01-27 07:02:15 +00:00
Merge the 1.5.2 changes from trunk.
[SVN r62830]
This commit is contained in:
@@ -7,14 +7,11 @@
|
||||
=============================================================================*/
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
#include "input_path.hpp"
|
||||
#include "./input_path.hpp"
|
||||
|
||||
#if defined(__cygwin__) || defined(__CYGWIN__)
|
||||
#include <boost/filesystem/config.hpp>
|
||||
#include <windows.h>
|
||||
#include <sys/cygwin.h>
|
||||
#endif
|
||||
#if !(defined(__cygwin__) || defined(__CYGWIN__))
|
||||
|
||||
// Everything but cygwin
|
||||
|
||||
namespace quickbook { namespace detail
|
||||
{
|
||||
@@ -25,18 +22,84 @@ namespace quickbook { namespace detail
|
||||
std::string path
|
||||
= boost::program_options::validators::get_single_string(values);
|
||||
|
||||
#if !(defined(__cygwin__) || defined(__CYGWIN__))
|
||||
v = input_path(path);
|
||||
#elif defined(BOOST_WINDOWS_PATH)
|
||||
}
|
||||
}}
|
||||
|
||||
#elif defined(QUICKBOOK_CYGWIN_1_5)
|
||||
|
||||
// Cygwin 1.5.x
|
||||
|
||||
#include <boost/filesystem/config.hpp>
|
||||
#include <windows.h>
|
||||
#include <sys/cygwin.h>
|
||||
|
||||
namespace quickbook { namespace detail
|
||||
{
|
||||
void validate(boost::any& v,
|
||||
const std::vector<std::string>& values,
|
||||
input_path*, int)
|
||||
{
|
||||
std::string path
|
||||
= boost::program_options::validators::get_single_string(values);
|
||||
|
||||
char result[MAX_PATH + 1];
|
||||
|
||||
#if defined(BOOST_WINDOWS_PATH)
|
||||
cygwin_conv_to_win32_path(path.c_str(), result);
|
||||
v = input_path(result);
|
||||
#elif defined(BOOST_POSIX_PATH)
|
||||
char result[MAX_PATH + 1];
|
||||
cygwin_conv_to_posix_path(path.c_str(), result);
|
||||
v = input_path(result);
|
||||
#else
|
||||
# error "Bosot filesystem path type doesn't seem to be set."
|
||||
#endif
|
||||
|
||||
v = input_path(result);
|
||||
}
|
||||
}}
|
||||
|
||||
#else
|
||||
|
||||
// Cygwin 1.7.x
|
||||
|
||||
#include <boost/filesystem/config.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/program_options/errors.hpp>
|
||||
#include <windows.h>
|
||||
#include <sys/cygwin.h>
|
||||
|
||||
namespace quickbook { namespace detail
|
||||
{
|
||||
void validate(boost::any& v,
|
||||
const std::vector<std::string>& values,
|
||||
input_path*, int)
|
||||
{
|
||||
std::string path
|
||||
= boost::program_options::validators::get_single_string(values);
|
||||
|
||||
#if defined(BOOST_WINDOWS_PATH)
|
||||
cygwin_conv_path_t flags = CCP_POSIX_TO_WIN_A | CCP_RELATIVE;
|
||||
#elif defined(BOOST_POSIX_PATH)
|
||||
cygwin_conv_path_t flags = CCP_WIN_A_TO_POSIX | CCP_RELATIVE;
|
||||
#else
|
||||
# error "Bosot filesystem path type doesn't seem to be set."
|
||||
#endif
|
||||
|
||||
ssize_t size = cygwin_conv_path(flags, path.c_str(), NULL, 0);
|
||||
|
||||
if (size < 0) {
|
||||
throw boost::program_options::validation_error(
|
||||
boost::program_options::validation_error::invalid_option_value);
|
||||
}
|
||||
|
||||
boost::scoped_array<char> result(new char[size]);
|
||||
|
||||
if(cygwin_conv_path(flags, path.c_str(), result.get(), size)) {
|
||||
throw boost::program_options::validation_error(
|
||||
boost::program_options::validation_error::invalid_option_value);
|
||||
}
|
||||
|
||||
v = input_path(result.get());
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user