diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2013-05-27 01:24:53 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2013-05-27 01:24:53 (GMT) |
commit | 08952ee2164efd8257adbd8684317ec1c945b7ac (patch) | |
tree | 5b50d417d950ad27e90f2765977e42caac1a881d /src/PlatformUtils.cc | |
parent | 31c88a434b3201d88819b485f74da843c2728cb2 (diff) |
windows - library path find, also windows build fixes
Diffstat (limited to 'src/PlatformUtils.cc')
-rw-r--r-- | src/PlatformUtils.cc | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/PlatformUtils.cc b/src/PlatformUtils.cc index a7efe40..47569b0 100644 --- a/src/PlatformUtils.cc +++ b/src/PlatformUtils.cc @@ -1,26 +1,35 @@ #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; - bool OK = true; try { path = boosty::canonical(fs::path(PlatformUtils::documentsPath())); if (path.empty()) return ""; - PRINTB("path size %i",boosty::stringy(path).size()); path /= "OpenSCAD"; path /= "libraries"; - PRINTB("Appended path %s", path ); - PRINTB("Exists: %i", fs::exists(path) ); - if (!fs::exists(path)) { - PRINTB("Creating library folder %s", boosty::stringy(path) ); - OK &= fs::create_directories( path ); - } - if (!OK) { - PRINTB("ERROR: Cannot find nor create %s", boosty::stringy(path) ); - path = fs::path(""); - } + //PRINTB("path size %i",boosty::stringy(path).size()); + //PRINTB("Appended path %s", path ); + //PRINTB("Exists: %i", fs::exists(path) ); } catch (const fs::filesystem_error& ex) { PRINTB("ERROR: %s",ex.what()); } |