From ebf9ee0f9f525d91b34224565da2d594d500484f Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 23 Oct 2012 22:10:15 -0400 Subject: Support specifying an OPENSCADPATH environment variable which will have precedence over the hardcoded library paths. First step of issue #125 diff --git a/doc/TODO.txt b/doc/TODO.txt index c58a942..be70c26 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -240,6 +240,7 @@ o Collect "all" available OpenSCAD scripts from the internets and run the integr MISSING TESTS: -------------- o cmd-line -D variable override +o OPENSCADPATH env.variable o all functions o mirror o scale diff --git a/src/parsersettings.cc b/src/parsersettings.cc index 47859c7..3dda132 100644 --- a/src/parsersettings.cc +++ b/src/parsersettings.cc @@ -28,7 +28,15 @@ std::string locate_file(const std::string &filename) void parser_init(const std::string &applicationpath) { - // FIXME: Append paths from OPENSCADPATH before adding built-in paths + // Add path from OPENSCADPATH before adding built-in paths + const char *openscadpath = getenv("OPENSCADPATH"); + if (openscadpath) { + add_librarydir(boosty::absolute(fs::path(openscadpath)).string()); + } + + // FIXME: Support specifying more than one path in OPENSCADPATH + // FIXME: Add ~/.openscad/libraries + // FIXME: Add ~/Documents/OpenSCAD/libraries on Mac? std::string librarydir; fs::path libdir(applicationpath); -- cgit v0.10.1