blob: a7efe409526d49e5d105e25e41cc0335f659a14c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include "PlatformUtils.h"
#include "boosty.h"
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("");
}
} catch (const fs::filesystem_error& ex) {
PRINTB("ERROR: %s",ex.what());
}
return boosty::stringy( path );
}
|