diff options
author | Marius Kintel <marius@kintel.net> | 2013-03-28 03:55:51 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-03-28 03:55:51 (GMT) |
commit | eefcd6d0b271642d470cd55bc47d1579d943938e (patch) | |
tree | 48f9e4db455879025adb9317b740bfa4b72c2d66 /src/parsersettings.cc | |
parent | f70578f362c8c2c78036c9de846c20802ac7aa81 (diff) | |
parent | beff2b1f4811b7f9d2b58bfc6a469a363bc9bfd0 (diff) |
Merge branch 'master' into epec-kernel
Conflicts:
src/PolySetCGALEvaluator.cc
Diffstat (limited to 'src/parsersettings.cc')
-rw-r--r-- | src/parsersettings.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/parsersettings.cc b/src/parsersettings.cc index 3dda132..a757ba1 100644 --- a/src/parsersettings.cc +++ b/src/parsersettings.cc @@ -2,7 +2,9 @@ #include <boost/filesystem.hpp> #include <boost/foreach.hpp> #include "boosty.h" +#include <boost/algorithm/string.hpp> #include <qglobal.h> // Needed for Q_ defines - move the offending code somewhere else +#include "CocoaUtils.h" namespace fs = boost::filesystem; @@ -28,15 +30,24 @@ std::string locate_file(const std::string &filename) void parser_init(const std::string &applicationpath) { - // Add path from OPENSCADPATH before adding built-in paths - const char *openscadpath = getenv("OPENSCADPATH"); - if (openscadpath) { - add_librarydir(boosty::absolute(fs::path(openscadpath)).string()); + // Add paths from OPENSCADPATH before adding built-in paths + const char *openscadpaths = getenv("OPENSCADPATH"); + if (openscadpaths) { + std::string paths(openscadpaths); + typedef boost::split_iterator<std::string::iterator> string_split_iterator; + for (string_split_iterator it = + make_split_iterator(paths, first_finder(":", boost::is_iequal())); + it != string_split_iterator(); + ++it) { + add_librarydir(boosty::absolute(fs::path(boost::copy_range<std::string>(*it))).string()); + } } - // FIXME: Support specifying more than one path in OPENSCADPATH // FIXME: Add ~/.openscad/libraries - // FIXME: Add ~/Documents/OpenSCAD/libraries on Mac? +#if defined(__APPLE__) && !defined(OPENSCAD_TESTING) + fs::path docdir(CocoaUtils::documentsPath()); + add_librarydir(boosty::stringy(docdir / "OpenSCAD" / "libraries")); +#endif std::string librarydir; fs::path libdir(applicationpath); |