diff options
-rw-r--r-- | bison.pri | 4 | ||||
-rw-r--r-- | boost.pri | 4 | ||||
-rw-r--r-- | cgal.pri | 4 | ||||
-rw-r--r-- | common.pri | 2 | ||||
-rw-r--r-- | openscad.pro | 18 | ||||
-rwxr-xr-x | scripts/release-common.sh | 32 | ||||
-rw-r--r-- | src/CGALEvaluator.cc | 2 | ||||
-rw-r--r-- | src/CSGTermEvaluator.cc | 2 | ||||
-rw-r--r-- | src/CocoaUtils.h | 3 | ||||
-rw-r--r-- | src/CocoaUtils.mm | 5 | ||||
-rw-r--r-- | src/MainWindow.h | 1 | ||||
-rw-r--r-- | src/MainWindow.ui | 6 | ||||
-rw-r--r-- | src/PlatformUtils-mac.mm | 7 | ||||
-rw-r--r-- | src/PlatformUtils-posix.cc | 10 | ||||
-rw-r--r-- | src/PlatformUtils-win.cc | 70 | ||||
-rw-r--r-- | src/PlatformUtils.cc | 40 | ||||
-rw-r--r-- | src/PlatformUtils.h | 14 | ||||
-rw-r--r-- | src/cgaladv.cc | 1 | ||||
-rw-r--r-- | src/control.cc | 2 | ||||
-rw-r--r-- | src/csgops.cc | 1 | ||||
-rw-r--r-- | src/import.cc | 2 | ||||
-rw-r--r-- | src/mainwin.cc | 18 | ||||
-rw-r--r-- | src/parsersettings.cc | 13 | ||||
-rw-r--r-- | src/system-gl.cc | 3 | ||||
-rw-r--r-- | win.pri (renamed from win32.pri) | 0 |
25 files changed, 220 insertions, 44 deletions
@@ -3,7 +3,7 @@ bison.input = BISONSOURCES bison.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.cpp bison.commands = bison -d -p ${QMAKE_FILE_BASE} -o ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.cpp ${QMAKE_FILE_IN} - bison.commands += && mv ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.hpp ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.h + bison.commands += && if [ -e ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.hpp ]; then mv ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.hpp ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.h ; fi bison.CONFIG += target_predeps bison.variable_out = GENERATED_SOURCES silent:bison.commands = @echo Bison ${QMAKE_FILE_IN} && $$bison.commands @@ -11,7 +11,7 @@ bison_header.input = BISONSOURCES bison_header.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.h bison_header.commands = bison -d -p ${QMAKE_FILE_BASE} -o ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.cpp ${QMAKE_FILE_IN} - bison_header.commands += && mv ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.hpp ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.h + bison_header.commands += && if [ -e ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.hpp ]; then mv ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.hpp ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.h ; fi bison_header.CONFIG += target_predeps no_link silent:bison_header.commands = @echo Bison ${QMAKE_FILE_IN} && $$bison.commands QMAKE_EXTRA_COMPILERS += bison_header @@ -6,7 +6,7 @@ boost { !isEmpty(BOOST_DIR) { QMAKE_INCDIR += $$BOOST_DIR message("boost location: $$BOOST_DIR") - win32: QMAKE_LIBDIR += -L$$BOOST_DIR/lib + win*: QMAKE_LIBDIR += -L$$BOOST_DIR/lib } CONFIG(mingw-cross-env) { @@ -16,7 +16,7 @@ boost { BOOST_LINK_FLAGS = -lboost_thread_win32-mt -lboost_program_options-mt -lboost_filesystem-mt -lboost_system-mt -lboost_regex-mt -lboost_chrono-mt } - isEmpty(BOOST_LINK_FLAGS):win32 { + isEmpty(BOOST_LINK_FLAGS):win* { BOOST_LINK_FLAGS = -llibboost_thread-vc90-mt-s-1_46_1 -llibboost_program_options-vc90-mt-s-1_46_1 -llibboost_filesystem-vc90-mt-s-1_46_1 -llibboost_system-vc90-mt-s-1_46_1 -llibboost_regex-vc90-mt-s-1_46_1 } @@ -6,7 +6,7 @@ cgal { CGAL_DIR = $$(CGALDIR) !isEmpty(CGAL_DIR) { QMAKE_INCDIR += $$CGAL_DIR/include - win32: QMAKE_INCDIR += $$CGAL_DIR/auxiliary/gmp/include + win*: QMAKE_INCDIR += $$CGAL_DIR/auxiliary/gmp/include QMAKE_LIBDIR += $$CGAL_DIR/lib message("CGAL location: $$CGAL_DIR") } @@ -15,7 +15,7 @@ cgal { LIBS += -lgmp -lmpfr -lCGAL QMAKE_CXXFLAGS += -frounding-math } else { - win32 { + win* { *-g++* { QMAKE_CXXFLAGS += -frounding-math } @@ -3,7 +3,7 @@ MOC_DIR = objects UI_DIR = objects RCC_DIR = objects -include(win32.pri) +include(win.pri) include(flex.pri) include(bison.pri) include(cgal.pri) diff --git a/openscad.pro b/openscad.pro index 542bcc3..c007330 100644 --- a/openscad.pro +++ b/openscad.pro @@ -31,7 +31,7 @@ isEmpty(QT_VERSION) { include(version.pri) # for debugging link problems (use nmake -f Makefile.Release > log.txt) -win32 { +win* { # QMAKE_LFLAGS += -VERBOSE } debug: DEFINES += DEBUG @@ -88,7 +88,7 @@ else { TARGET = openscad } -win32 { +win* { RC_FILE = openscad_win32.rc } @@ -171,7 +171,7 @@ CONFIG(mingw-cross-env) { include(mingw-cross-env.pri) } -win32 { +win* { FLEXSOURCES = src/lexer.l BISONSOURCES = src/parser.y } else { @@ -302,6 +302,7 @@ SOURCES += src/version_check.cc \ src/parsersettings.cc \ src/stl-utils.cc \ src/boost-utils.cc \ + src/PlatformUtils.cc \ \ src/nodedumper.cc \ src/traverser.cc \ @@ -347,7 +348,7 @@ macx { SOURCES += src/imageutils-macosx.cc OBJECTIVE_SOURCES += src/OffscreenContextCGL.mm } -win32* { +win* { SOURCES += src/imageutils-lodepng.cc SOURCES += src/OffscreenContextWGL.cc } @@ -384,7 +385,14 @@ macx { src/EventFilter.h \ src/CocoaUtils.h SOURCES += src/AppleEvents.cc - OBJECTIVE_SOURCES += src/CocoaUtils.mm + OBJECTIVE_SOURCES += src/CocoaUtils.mm \ + src/PlatformUtils-mac.mm +} +unix:!macx { + SOURCES += src/PlatformUtils-posix.cc +} +win* { + SOURCES += src/PlatformUtils-win.cc } isEmpty(PREFIX):PREFIX = /usr/local diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 7d36907..8a1ed7c 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -52,13 +52,13 @@ elif [[ $OSTYPE == "linux-gnu" ]]; then fi if [ "`echo $* | grep mingw32`" ]; then - OS=LINXWIN + OS=UNIX_CROSS_WIN ARCH=32 echo Mingw-cross build using ARCH=32 fi if [ "`echo $* | grep mingw64`" ]; then - OS=LINXWIN + OS=UNIX_CROSS_WIN ARCH=64 echo Mingw-cross build using ARCH=64 fi @@ -90,7 +90,7 @@ fi echo "Checking pre-requisites..." case $OS in - LINXWIN) + UNIX_CROSS_WIN) MAKENSIS= if [ "`command -v makensis`" ]; then MAKENSIS=makensis @@ -120,10 +120,9 @@ echo "Building openscad-$VERSION ($VERSIONDATE) $CONFIGURATION..." if [ ! $NUMCPU ]; then echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)"; - NUMCPU=2 -else - echo "NUMCPU: " $NUMCPU + NUMCPU=1 fi +echo "NUMCPU: " $NUMCPU CONFIG=deploy case $OS in @@ -138,7 +137,7 @@ case $OS in ZIPARGS="a -tzip" TARGET=release ;; - LINXWIN) + UNIX_CROSS_WIN) . ./scripts/setenv-mingw-xbuild.sh $ARCH TARGET=release ZIP="zip" @@ -148,7 +147,7 @@ esac case $OS in - LINXWIN) + UNIX_CROSS_WIN) cd $DEPLOYDIR && qmake VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+=$CONFIG CONFIG+=mingw-cross-env CONFIG-=debug ../openscad.pro cd $OPENSCADDIR ;; @@ -158,7 +157,7 @@ case $OS in esac case $OS in - LINXWIN) + UNIX_CROSS_WIN) cd $DEPLOYDIR make clean ## comment out for test-run cd $OPENSCADDIR @@ -176,10 +175,17 @@ case $OS in #if the following files are missing their tried removal stops the build process on msys touch -t 200012121010 parser_yacc.h parser_yacc.cpp lexer_lex.cpp ;; + UNIX_CROSS_WIN) + # kludge to enable paralell make + touch -t 200012121010 $OPENSCADDIR/src/parser_yacc.h + touch -t 200012121010 $OPENSCADDIR/src/parser_yacc.cpp + touch -t 200012121010 $OPENSCADDIR/src/parser_yacc.hpp + touch -t 200012121010 $OPENSCADDIR/src/lexer_lex.cpp + ;; esac case $OS in - LINXWIN) + UNIX_CROSS_WIN) # make main openscad.exe cd $DEPLOYDIR make $TARGET -j$NUMCPU ## comment 4 test @@ -214,12 +220,12 @@ case $OS in EXAMPLESDIR=OpenSCAD.app/Contents/Resources/examples LIBRARYDIR=OpenSCAD.app/Contents/Resources/libraries ;; - LINXWIN) + UNIX_CROSS_WIN) EXAMPLESDIR=$DEPLOYDIR/openscad-$VERSION/examples/ LIBRARYDIR=$DEPLOYDIR/openscad-$VERSION/libraries/ rm -rf $DEPLOYDIR/openscad-$VERSION mkdir $DEPLOYDIR/openscad-$VERSION - ;; + ;; *) EXAMPLESDIR=openscad-$VERSION/examples/ LIBRARYDIR=openscad-$VERSION/libraries/ @@ -267,7 +273,7 @@ case $OS in rm -rf openscad-$VERSION echo "Binary created: openscad-$VERSION.zip" ;; - LINXWIN) + UNIX_CROSS_WIN) BINFILE=$DEPLOYDIR/OpenSCAD-$VERSION-x86-$ARCH.zip INSTFILE=$DEPLOYDIR/OpenSCAD-$VERSION-x86-$ARCH-Installer.exe diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index d0140fa..686bde1 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -279,7 +279,7 @@ Response CGALEvaluator::visit(State &state, const CsgNode &node) if (state.isPostfix()) { CGAL_Nef_polyhedron N; if (!isCached(node)) { - CGALEvaluator::CsgOp op; + CGALEvaluator::CsgOp op = CGE_UNION; switch (node.type) { case CSG_TYPE_UNION: op = CGE_UNION; diff --git a/src/CSGTermEvaluator.cc b/src/CSGTermEvaluator.cc index 9fc3147..a6b654c 100644 --- a/src/CSGTermEvaluator.cc +++ b/src/CSGTermEvaluator.cc @@ -126,7 +126,7 @@ Response CSGTermEvaluator::visit(State &state, const AbstractPolyNode &node) Response CSGTermEvaluator::visit(State &state, const CsgNode &node) { if (state.isPostfix()) { - CsgOp op; + CsgOp op = CSGT_UNION; switch (node.type) { case CSG_TYPE_UNION: op = CSGT_UNION; diff --git a/src/CocoaUtils.h b/src/CocoaUtils.h index ad5518b..8543d84 100644 --- a/src/CocoaUtils.h +++ b/src/CocoaUtils.h @@ -1,13 +1,10 @@ #ifndef COCOAUTILS_H_ #define COCOAUTILS_H_ -#include <string> - class CocoaUtils { public: static void endApplication(); - static std::string documentsPath(); }; #endif diff --git a/src/CocoaUtils.mm b/src/CocoaUtils.mm index 295ceb9..b72583c 100644 --- a/src/CocoaUtils.mm +++ b/src/CocoaUtils.mm @@ -1,6 +1,5 @@ #include "CocoaUtils.h" #import <Foundation/Foundation.h> -#include <stdio.h> void CocoaUtils::endApplication() { @@ -9,7 +8,3 @@ void CocoaUtils::endApplication() object:nil]; } -std::string CocoaUtils::documentsPath() -{ - return std::string([[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] UTF8String]); -} diff --git a/src/MainWindow.h b/src/MainWindow.h index 378705e..bd32bdd 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -101,6 +101,7 @@ private slots: void actionSave(); void actionSaveAs(); void actionReload(); + void actionShowLibraryFolder(); private slots: void pasteViewportTranslation(); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 8e995cd..e9bd96e 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -137,6 +137,7 @@ <addaction name="fileActionOpen"/> <addaction name="menuOpenRecent"/> <addaction name="menuExamples"/> + <addaction name="fileShowLibraryFolder"/> <addaction name="separator"/> <addaction name="fileActionClose"/> <addaction name="fileActionSave"/> @@ -688,6 +689,11 @@ <string>Check for Update..</string> </property> </action> + <action name="fileShowLibraryFolder"> + <property name="text"> + <string>Show Library Folder...</string> + </property> + </action> </widget> <customwidgets> <customwidget> diff --git a/src/PlatformUtils-mac.mm b/src/PlatformUtils-mac.mm new file mode 100644 index 0000000..1e2ba43 --- /dev/null +++ b/src/PlatformUtils-mac.mm @@ -0,0 +1,7 @@ +#include "PlatformUtils.h" +#import <Foundation/Foundation.h> + +std::string PlatformUtils::documentsPath() +{ + return std::string([[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] UTF8String]); +} diff --git a/src/PlatformUtils-posix.cc b/src/PlatformUtils-posix.cc new file mode 100644 index 0000000..d7b7b6d --- /dev/null +++ b/src/PlatformUtils-posix.cc @@ -0,0 +1,10 @@ +#include "PlatformUtils.h" +#include "boosty.h" + +std::string PlatformUtils::documentsPath() +{ + fs::path docpath(getenv("HOME")); + docpath = docpath / ".local" / "share"; + + return boosty::stringy(docpath); +} diff --git a/src/PlatformUtils-win.cc b/src/PlatformUtils-win.cc new file mode 100644 index 0000000..a58a346 --- /dev/null +++ b/src/PlatformUtils-win.cc @@ -0,0 +1,70 @@ +#include "PlatformUtils.h" +#include "printutils.h" +#include <windows.h> +#ifndef _WIN32_IE +#define _WIN32_IE 0x0501 // SHGFP_TYPE_CURRENT +#endif +#include <shlobj.h> + +// convert from windows api w_char strings (usually utf16) to utf8 std::string +std::string winapi_wstr_to_utf8( std::wstring wstr ) +{ + UINT CodePage = CP_UTF8; + DWORD dwFlags = 0; + LPCWSTR lpWideCharStr = &wstr[0]; + int cchWideChar = (int)wstr.size(); + LPSTR lpMultiByteStr = NULL; + int cbMultiByte = 0; + LPCSTR lpDefaultChar = NULL; + LPBOOL lpUsedDefaultChar = NULL; + + int numbytes = WideCharToMultiByte( CodePage, dwFlags, lpWideCharStr, + cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar ); + + //PRINTB("utf16 to utf8 conversion: numbytes %i",numbytes); + + std::string utf8_str(numbytes,0); + lpMultiByteStr = &utf8_str[0]; + cbMultiByte = numbytes; + + int result = WideCharToMultiByte( CodePage, dwFlags, lpWideCharStr, + cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar ); + + if (result != numbytes) { + PRINT("ERROR: error converting w_char str to utf8 string"); + PRINTB("ERROR: error code %i",GetLastError()); + } + + return utf8_str; +} + + +// retrieve the path to 'My Documents' for the current user under windows +// In XP this is 'c:\documents and settings\username\my documents' +// In Vista, 7, 8+ this is 'c:\users\username\documents' +// This code may have problems with unusual dir types in Vista because +// Mingw does not provide access to the updated SHGetKnownFolderPath +std::string PlatformUtils::documentsPath() +{ + std::string retval; + std::wstring path(MAX_PATH,0); + + HWND hwndOwner = 0; + int nFolder = CSIDL_PERSONAL; + HANDLE hToken = NULL; + DWORD dwFlags = SHGFP_TYPE_CURRENT; + LPTSTR pszPath = &path[0]; + + int result = SHGetFolderPathW( hwndOwner, nFolder, hToken, dwFlags, pszPath ); + + if (result == S_OK) { + path = std::wstring( path.c_str() ); // stip extra NULLs + //std::wcerr << "wchar path:" << "\n"; + retval = winapi_wstr_to_utf8( path ); + //PRINTB("Path found: %s",retval); + } else { + PRINT("ERROR: Could not find My Documents location"); + retval = ""; + } + return retval; +} diff --git a/src/PlatformUtils.cc b/src/PlatformUtils.cc new file mode 100644 index 0000000..5dd007d --- /dev/null +++ b/src/PlatformUtils.cc @@ -0,0 +1,40 @@ +#include "PlatformUtils.h" +#include "boosty.h" + +bool PlatformUtils::createLibraryPath() +{ + std::string path = PlatformUtils::libraryPath(); + bool OK = false; + try { + if (!fs::exists(fs::path(path))) { + //PRINTB("Creating library folder %s", path ); + OK = fs::create_directories( path ); + } + if (!OK) { + PRINTB("ERROR: Cannot create %s", path ); + } + } catch (const fs::filesystem_error& ex) { + PRINTB("ERROR: %s",ex.what()); + } + return OK; +} + +std::string PlatformUtils::libraryPath() +{ + fs::path path; + try { + std::string pathstr = PlatformUtils::documentsPath(); + if (pathstr=="") return ""; + path = boosty::canonical(fs::path( pathstr )); + //PRINTB("path size %i",boosty::stringy(path).size()); + //PRINTB("lib path found: [%s]", path ); + if (path.empty()) return ""; + path /= "OpenSCAD"; + path /= "libraries"; + //PRINTB("Appended path %s", path ); + //PRINTB("Exists: %i", fs::exists(path) ); + } catch (const fs::filesystem_error& ex) { + PRINTB("ERROR: %s",ex.what()); + } + return boosty::stringy( path ); +} diff --git a/src/PlatformUtils.h b/src/PlatformUtils.h new file mode 100644 index 0000000..089b3ca --- /dev/null +++ b/src/PlatformUtils.h @@ -0,0 +1,14 @@ +#ifndef PLATFORMUTILS_H_ +#define PLATFORMUTILS_H_ + +#include <string> + +namespace PlatformUtils { + + std::string documentsPath(); + std::string libraryPath(); + bool createLibraryPath(); + +} + +#endif diff --git a/src/cgaladv.cc b/src/cgaladv.cc index 70590f7..ee3d657 100644 --- a/src/cgaladv.cc +++ b/src/cgaladv.cc @@ -142,6 +142,7 @@ std::string CgaladvNode::name() const default: assert(false); } + return "internal_error"; } std::string CgaladvNode::toString() const diff --git a/src/control.cc b/src/control.cc index 7786e36..c5ad09b 100644 --- a/src/control.cc +++ b/src/control.cc @@ -114,7 +114,7 @@ AbstractNode *ControlModule::instantiate(const Context *ctx, const ModuleInstant // assert(filectx->evalctx); if (filectx->evalctx) { - if (n < filectx->evalctx->numChildren()) { + if (n < (int)filectx->evalctx->numChildren()) { node = filectx->evalctx->getChild(n)->evaluate(filectx->evalctx); } else { diff --git a/src/csgops.cc b/src/csgops.cc index 92b97e7..8ac1d4f 100644 --- a/src/csgops.cc +++ b/src/csgops.cc @@ -69,6 +69,7 @@ std::string CsgNode::name() const default: assert(false); } + return "internal_error"; } void register_builtin_csgops() diff --git a/src/import.cc b/src/import.cc index 2180684..b5d67d2 100644 --- a/src/import.cc +++ b/src/import.cc @@ -204,7 +204,7 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const boost::regex ex_vertices("\\s*vertex\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)"); bool binary = false; - int file_size = f.tellg(); + std::streampos file_size = f.tellg(); f.seekg(80); if (!f.eof()) { uint32_t facenum = 0; diff --git a/src/mainwin.cc b/src/mainwin.cc index 8151e29..08f0435 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -53,6 +53,7 @@ #ifdef Q_OS_MAC #include "CocoaUtils.h" #endif +#include "PlatformUtils.h" #include <QMenu> #include <QTime> @@ -104,6 +105,8 @@ #define OPENCSG_VERSION_STRING "unknown, <1.3.2" #endif +#include "boosty.h" + extern QString examplesdir; // Global application state @@ -227,6 +230,7 @@ MainWindow::MainWindow(const QString &filename) connect(this->fileActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); connect(this->fileActionReload, SIGNAL(triggered()), this, SLOT(actionReload())); connect(this->fileActionQuit, SIGNAL(triggered()), this, SLOT(quit())); + connect(this->fileShowLibraryFolder, SIGNAL(triggered()), this, SLOT(actionShowLibraryFolder())); #ifndef __APPLE__ QList<QKeySequence> shortcuts = this->fileActionSave->shortcuts(); shortcuts.push_back(QKeySequence(Qt::Key_F2)); @@ -951,6 +955,20 @@ void MainWindow::actionSaveAs() } } +void MainWindow::actionShowLibraryFolder() +{ + std::string path = PlatformUtils::libraryPath(); + if (!fs::exists(path)) { + PRINTB("WARNING: Library path %s doesnt exist. Creating", path); + if (!PlatformUtils::createLibraryPath()) { + PRINTB("ERROR: Cannot create library path: %s",path); + } + } + QString url = QString::fromStdString( path ); + //PRINTB("Opening file browser for %s", url.toStdString() ); + QDesktopServices::openUrl(QUrl::fromLocalFile( url )); +} + void MainWindow::actionReload() { if (checkEditorModified()) refreshDocument(); diff --git a/src/parsersettings.cc b/src/parsersettings.cc index cb7c93d..8db33a8 100644 --- a/src/parsersettings.cc +++ b/src/parsersettings.cc @@ -3,9 +3,7 @@ #include <boost/foreach.hpp> #include "boosty.h" #include <boost/algorithm/string.hpp> -#ifdef __APPLE__ -#include "CocoaUtils.h" -#endif +#include "PlatformUtils.h" namespace fs = boost::filesystem; @@ -104,12 +102,15 @@ void parser_init(const std::string &applicationpath) } } - // FIXME: Add ~/.openscad/libraries -#if defined(__APPLE__) && !defined(OPENSCAD_TESTING) - fs::path docdir(CocoaUtils::documentsPath()); + // This is the built-in user-writable library path +#ifndef OPENSCAD_TESTING + // This will resolve to ~/Documents on Mac, "My Documents" on Windows and + // ~/.local/share on Linux + fs::path docdir(PlatformUtils::documentsPath()); add_librarydir(boosty::stringy(docdir / "OpenSCAD" / "libraries")); #endif + // This is the built-in read-only library path std::string librarydir; fs::path libdir(applicationpath); fs::path tmpdir; diff --git a/src/system-gl.cc b/src/system-gl.cc index 0c436e5..098dcb2 100644 --- a/src/system-gl.cc +++ b/src/system-gl.cc @@ -46,7 +46,8 @@ string glew_extensions_dump() sort( extensions.begin(), extensions.end() ); stringstream out; out << "GL Extensions:"; - for ( int i=0;i<extensions.size();i++ ) out << extensions[i] << "\n"; + for ( unsigned int i=0;i<extensions.size();i++ ) + out << extensions[i] << "\n"; return out.str(); } |