diff --git a/src/context.cc b/src/context.cc index 354195fa..8d7b903c 100644 --- a/src/context.cc +++ b/src/context.cc @@ -33,6 +33,7 @@ #include #include using namespace boost::filesystem; +#include "boosty.h" std::vector Context::ctx_stack; @@ -176,7 +177,7 @@ AbstractNode *Context::evaluate_module(const ModuleInstantiation &inst) const std::string Context::getAbsolutePath(const std::string &filename) const { if (!filename.empty()) { - return absolute(path(this->document_path) / filename).string(); + return boosty::absolute(path(this->document_path) / filename).string(); } else { return filename; diff --git a/src/handle_dep.cc b/src/handle_dep.cc index d6425550..cbf7157d 100644 --- a/src/handle_dep.cc +++ b/src/handle_dep.cc @@ -7,6 +7,7 @@ #include #include using namespace boost::filesystem; +#include "boosty.h" boost::unordered_set dependencies; const char *make_command = NULL; @@ -14,7 +15,7 @@ const char *make_command = NULL; void handle_dep(const std::string &filename) { path filepath(filename); - if (filepath.is_absolute()) { + if ( boosty::is_absolute( filepath )) { dependencies.insert(filename); } else { diff --git a/src/import.cc b/src/import.cc index 435d06d8..e90965e6 100644 --- a/src/import.cc +++ b/src/import.cc @@ -50,6 +50,7 @@ using namespace boost::filesystem; #include using namespace boost::assign; // bring 'operator+=()' into scope +#include "boosty.h" class ImportModule : public AbstractModule { @@ -81,7 +82,8 @@ AbstractNode *ImportModule::evaluate(const Context *ctx, const ModuleInstantiati std::string filename = c.getAbsolutePath(v.text); import_type_e actualtype = this->type; if (actualtype == TYPE_UNKNOWN) { - std::string ext = boost::algorithm::to_lower_copy(path(filename).extension().string()); + std::string extraw = boosty::extension_str( path(filename) ); + std::string ext = boost::algorithm::to_lower_copy( extraw ); if (ext == ".stl") actualtype = TYPE_STL; else if (ext == ".off") actualtype = TYPE_OFF; else if (ext == ".dxf") actualtype = TYPE_DXF; diff --git a/src/lexer.l b/src/lexer.l index 718874ff..77308a07 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -35,6 +35,7 @@ #include #include namespace fs = boost::filesystem; +#include "boosty.h" //isatty for visual c++ and mingw-cross-env #if defined __WIN32__ && ! defined _MSC_VER @@ -109,13 +110,13 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); } ">" { BEGIN(INITIAL); fs::path usepath; - if (fs::path(filename).is_absolute()) { + if ( boosty::is_absolute( fs::path(filename) ) ) { usepath = filename; } else { usepath = fs::path(parser_source_path) / filename; if (!fs::exists(usepath)) { - usepath = fs::absolute(fs::path(librarydir) / filename); + usepath = boosty::absolute(fs::path(librarydir) / filename); } } handle_dep(usepath.string()); @@ -198,7 +199,7 @@ void includefile() fs::path dirinfo = sourcepath(); if (!filepath.empty()) { - if (fs::path(filepath).is_absolute()) { + if (boosty::is_absolute( fs::path(filepath) ) ) { dirinfo = filepath; } else { @@ -214,8 +215,8 @@ void includefile() filepath.clear(); path_stack.push_back(dirinfo); - handle_dep(fs::absolute(finfo).string()); - yyin = fopen(fs::absolute(finfo).string().c_str(), "r"); + handle_dep(boosty::absolute(finfo).string()); + yyin = fopen(boosty::absolute(finfo).string().c_str(), "r"); if (!yyin) { PRINTF("WARNING: Can't open input file `%s'.", filename.c_str()); path_stack.pop_back(); diff --git a/src/openscad.cc b/src/openscad.cc index b29eafdf..b4d1c0f0 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -58,6 +58,7 @@ #include #include +#include "boosty.h" #ifdef _MSC_VER #define snprintf _snprintf @@ -199,7 +200,7 @@ int main(int argc, char **argv) } #endif - currentdir = fs::current_path().generic_string(); + currentdir = boosty::stringy( fs::current_path() ); QDir exdir(QApplication::instance()->applicationDirPath()); #ifdef Q_WS_MAC @@ -273,11 +274,13 @@ int main(int argc, char **argv) } fclose(fp); text << commandline_commands; - root_module = parse(text.str().c_str(), fs::absolute(filename).generic_string().c_str(), false); + fs::path abspath = boosty::absolute( filename ); + std::string fname = boosty::stringy( abspath ); + root_module = parse(text.str().c_str(), fname.c_str(), false); if (!root_module) exit(1); } - fs::path fpath = fs::absolute(fs::path(filename)); + fs::path fpath = boosty::absolute( fs::path(filename) ); fs::path fparent = fpath.parent_path(); fs::current_path( fparent ); @@ -374,7 +377,9 @@ int main(int argc, char **argv) #endif QString qfilename; - if (filename) qfilename = QString::fromStdString(fs::absolute(filename).string()); + fs::path abspath = boosty::absolute( filename ); + std::string absname = boosty::stringy( abspath ); + if (filename) qfilename = QString::fromStdString( absname ); #if 0 /*** disabled by clifford wolf: adds rendering artefacts with OpenCSG ***/ // turn on anti-aliasing diff --git a/src/parser.y b/src/parser.y index 1c4a7843..7e27bfe5 100644 --- a/src/parser.y +++ b/src/parser.y @@ -44,6 +44,7 @@ #include using namespace boost::filesystem; +#include "boosty.h" int parser_error_pos = -1; @@ -641,7 +642,8 @@ Module *Module::compile_library(const std::string &filename) libs_cache[filename] = e; Module *backup_mod = module; - Module *lib_mod = dynamic_cast(parse(text.str().c_str(), path(filename).parent_path().generic_string().c_str(), 0)); + std::string pathname = boosty::stringy( fs::path(filename).parent_path() ); + Module *lib_mod = dynamic_cast(parse(text.str().c_str(), pathname.c_str(), 0)); module = backup_mod; if (lib_mod) { diff --git a/src/parsersettings.cc b/src/parsersettings.cc index 2d0b1b3e..330e2e25 100644 --- a/src/parsersettings.cc +++ b/src/parsersettings.cc @@ -2,6 +2,7 @@ #include using namespace boost::filesystem; +#include "boosty.h" std::string librarydir; @@ -14,14 +15,14 @@ void parser_init(const std::string &applicationpath) if (!is_directory(libdir / "libraries")) libdir /= "../../.."; #elif defined(Q_OS_UNIX) if (is_directory(tmpdir = libdir / "../share/openscad/libraries")) { - librarydir = tmpdir.generic_string(); + librarydir = boosty::stringy( tmpdir ); } else if (is_directory(tmpdir = libdir / "../../share/openscad/libraries")) { - librarydir = tmpdir.generic_string(); + librarydir = boosty::stringy( tmpdir ); } else if (is_directory(tmpdir = libdir / "../../libraries")) { - librarydir = tmpdir.generic_string(); + librarydir = boosty::stringy( tmpdir ); } else #endif - if (is_directory(tmpdir = libdir / "libraries")) { - librarydir = tmpdir.generic_string(); + if (is_directory(tmpdir = libdir / "libraries")) { + librarydir = boosty::stringy( tmpdir ); } } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9d5e24e7..66958a8f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -125,10 +125,7 @@ if (NOT $ENV{BOOSTDIR} STREQUAL "") message(STATUS "BOOST_ROOT: " ${BOOST_ROOT}) endif() -find_package( Boost 1.44.0 COMPONENTS thread program_options filesystem system regex REQUIRED) -if ( ${Boost_VERSION} VERSION_LESS "104601" ) - add_definitions( -DBOOST_FILESYSTEM_VERSION=3 ) -endif() +find_package( Boost 1.42.0 COMPONENTS thread program_options filesystem system regex REQUIRED) message(STATUS "Boost includes found: " ${Boost_INCLUDE_DIRS}) message(STATUS "Boost libraries found:") foreach(boostlib ${Boost_LIBRARIES}) diff --git a/tests/cgalcachetest.cc b/tests/cgalcachetest.cc index ad856d25..1680c6e5 100644 --- a/tests/cgalcachetest.cc +++ b/tests/cgalcachetest.cc @@ -53,6 +53,7 @@ namespace fs = boost::filesystem; #include namespace po = boost::program_options; +#include "boosty.h" std::string commandline_commands; std::string currentdir; @@ -135,7 +136,7 @@ int main(int argc, char **argv) QApplication app(argc, argv, false); fs::path original_path = fs::current_path(); - currentdir = fs::current_path().generic_string(); + currentdir = boosty::stringy( fs::current_path() ); parser_init(QApplication::instance()->applicationDirPath().toStdString()); diff --git a/tests/cgalpngtest.cc b/tests/cgalpngtest.cc index ca375725..9002f3b1 100644 --- a/tests/cgalpngtest.cc +++ b/tests/cgalpngtest.cc @@ -53,6 +53,7 @@ #include namespace fs = boost::filesystem; +#include "boosty.h" std::string commandline_commands; std::string currentdir; @@ -108,7 +109,7 @@ int main(int argc, char **argv) QApplication app(argc, argv, false); fs::path original_path = fs::current_path(); - currentdir = fs::current_path().generic_string(); + currentdir = boosty::stringy( fs::current_path() ); parser_init(QApplication::instance()->applicationDirPath().toStdString()); diff --git a/tests/cgalstlsanitytest.cc b/tests/cgalstlsanitytest.cc index e537b4ad..548ab448 100644 --- a/tests/cgalstlsanitytest.cc +++ b/tests/cgalstlsanitytest.cc @@ -52,6 +52,7 @@ #include namespace fs = boost::filesystem; +#include "boosty.h" std::string commandline_commands; std::string currentdir; @@ -94,7 +95,7 @@ int main(int argc, char **argv) QApplication app(argc, argv, false); fs::path original_path = fs::current_path(); - currentdir = fs::current_path().generic_string(); + currentdir = boosty::stringy( fs::current_path() ); parser_init(QApplication::instance()->applicationDirPath().toStdString()); diff --git a/tests/cgaltest.cc b/tests/cgaltest.cc index 956bf437..4c23ee12 100644 --- a/tests/cgaltest.cc +++ b/tests/cgaltest.cc @@ -48,6 +48,7 @@ #include namespace fs = boost::filesystem; +#include "boosty.h" std::string commandline_commands; std::string currentdir; @@ -87,7 +88,7 @@ int main(int argc, char **argv) QApplication app(argc, argv, false); fs::path original_path = fs::current_path(); - currentdir = fs::current_path().generic_string(); + currentdir = boosty::stringy( fs::current_path() ); parser_init(QApplication::instance()->applicationDirPath().toStdString()); diff --git a/tests/csgtermtest.cc b/tests/csgtermtest.cc index 016285e9..a7369e88 100644 --- a/tests/csgtermtest.cc +++ b/tests/csgtermtest.cc @@ -49,6 +49,7 @@ #include namespace fs = boost::filesystem; +#include "boosty.h" std::string commandline_commands; std::string currentdir; @@ -73,7 +74,7 @@ int main(int argc, char **argv) QApplication app(argc, argv, false); fs::path original_path = fs::current_path(); - currentdir = fs::current_path().generic_string(); + currentdir = boosty::stringy( fs::current_path() ); parser_init(QApplication::instance()->applicationDirPath().toStdString()); diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index 65e9127c..b5a62240 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -34,6 +34,7 @@ namespace po = boost::program_options; namespace fs = boost::filesystem; +#include "boosty.h" using std::string; using std::vector; @@ -254,7 +255,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) fs::path original_path = fs::current_path(); - std::string currentdir = fs::current_path().generic_string(); + std::string currentdir = boosty::stringy( fs::current_path() ); parser_init(QApplication::instance()->applicationDirPath().toStdString()); diff --git a/tests/csgtexttest.cc b/tests/csgtexttest.cc index daed4e41..4a1c9c6b 100644 --- a/tests/csgtexttest.cc +++ b/tests/csgtexttest.cc @@ -48,6 +48,7 @@ #include namespace fs = boost::filesystem; +#include "boosty.h" std::string commandline_commands; std::string currentdir; @@ -77,7 +78,7 @@ int main(int argc, char **argv) QApplication app(argc, argv, false); fs::path original_path = fs::current_path(); - currentdir = fs::current_path().generic_string(); + currentdir = boosty::stringy( fs::current_path() ); parser_init(QApplication::instance()->applicationDirPath().toStdString()); diff --git a/tests/dumptest.cc b/tests/dumptest.cc index 6dd65a44..8353f26f 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -46,6 +46,7 @@ #include namespace fs = boost::filesystem; +#include "boosty.h" std::string commandline_commands; std::string currentdir; @@ -83,7 +84,7 @@ int main(int argc, char **argv) QApplication app(argc, argv, false); fs::path original_path = fs::current_path(); - currentdir = fs::current_path().generic_string(); + currentdir = boosty::stringy( fs::current_path() ); parser_init(QApplication::instance()->applicationDirPath().toStdString()); diff --git a/tests/echotest.cc b/tests/echotest.cc index 7abfd78a..b8815037 100644 --- a/tests/echotest.cc +++ b/tests/echotest.cc @@ -45,6 +45,7 @@ #include namespace fs = boost::filesystem; +#include "boosty.h" std::string commandline_commands; std::string currentdir; @@ -85,7 +86,7 @@ int main(int argc, char **argv) QApplication app(argc, argv, false); fs::path original_path = fs::current_path(); - currentdir = fs::current_path().generic_string(); + currentdir = boosty::stringy( fs::current_path() ); parser_init(QApplication::instance()->applicationDirPath().toStdString());