mirror of https://github.com/vitalif/openscad
Mac fix: We need to use bundled resources when running bundled apps in cmd-line node
parent
f7a633c57f
commit
20938506b6
|
@ -206,7 +206,7 @@ int cmdline(const char *deps_output_file, const std::string &filename, Camera &c
|
||||||
#else
|
#else
|
||||||
const std::string application_path = boosty::stringy(boosty::absolute(boost::filesystem::path(argv[0]).parent_path()));
|
const std::string application_path = boosty::stringy(boosty::absolute(boost::filesystem::path(argv[0]).parent_path()));
|
||||||
#endif
|
#endif
|
||||||
parser_init(application_path, false);
|
parser_init(application_path);
|
||||||
Tree tree;
|
Tree tree;
|
||||||
#ifdef ENABLE_CGAL
|
#ifdef ENABLE_CGAL
|
||||||
CGALEvaluator cgalevaluator(tree);
|
CGALEvaluator cgalevaluator(tree);
|
||||||
|
@ -516,7 +516,7 @@ int gui(vector<string> &inputFiles, const fs::path &original_path, int argc, cha
|
||||||
qexamplesdir = exdir.path();
|
qexamplesdir = exdir.path();
|
||||||
}
|
}
|
||||||
MainWindow::setExamplesDir(qexamplesdir);
|
MainWindow::setExamplesDir(qexamplesdir);
|
||||||
parser_init(app_path.toLocal8Bit().constData(), true);
|
parser_init(app_path.toLocal8Bit().constData());
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
installAppleEventHandlers();
|
installAppleEventHandlers();
|
||||||
|
|
|
@ -88,7 +88,7 @@ fs::path find_valid_path(const fs::path &sourcepath,
|
||||||
return fs::path();
|
return fs::path();
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser_init(const std::string &applicationpath, bool isgui)
|
void parser_init(const std::string &applicationpath)
|
||||||
{
|
{
|
||||||
// Add paths from OPENSCADPATH before adding built-in paths
|
// Add paths from OPENSCADPATH before adding built-in paths
|
||||||
const char *openscadpaths = getenv("OPENSCADPATH");
|
const char *openscadpaths = getenv("OPENSCADPATH");
|
||||||
|
@ -117,7 +117,8 @@ void parser_init(const std::string &applicationpath, bool isgui)
|
||||||
fs::path tmpdir;
|
fs::path tmpdir;
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// Libraries can be bundled on Mac. If not, fall back to development layout
|
// Libraries can be bundled on Mac. If not, fall back to development layout
|
||||||
if (isgui) {
|
bool isbundle = is_directory(libdir / ".." / "Resources");
|
||||||
|
if (isbundle) {
|
||||||
libdir /= "../Resources";
|
libdir /= "../Resources";
|
||||||
if (!is_directory(libdir / "libraries")) libdir /= "../../..";
|
if (!is_directory(libdir / "libraries")) libdir /= "../../..";
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
extern int parser_error_pos;
|
extern int parser_error_pos;
|
||||||
|
|
||||||
void parser_init(const std::string &applicationpath, bool isgui);
|
void parser_init(const std::string &applicationpath);
|
||||||
void add_librarydir(const std::string &libdir);
|
void add_librarydir(const std::string &libdir);
|
||||||
fs::path search_libs(const fs::path &localpath);
|
fs::path search_libs(const fs::path &localpath);
|
||||||
fs::path find_valid_path(const fs::path &sourcepath,
|
fs::path find_valid_path(const fs::path &sourcepath,
|
||||||
|
|
|
@ -126,7 +126,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
currentdir = boosty::stringy(fs::current_path());
|
currentdir = boosty::stringy(fs::current_path());
|
||||||
|
|
||||||
parser_init(boosty::stringy(fs::path(argv[0]).branch_path()), false);
|
parser_init(boosty::stringy(fs::path(argv[0]).branch_path()));
|
||||||
add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries"));
|
add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries"));
|
||||||
|
|
||||||
ModuleContext top_ctx;
|
ModuleContext top_ctx;
|
||||||
|
|
|
@ -77,7 +77,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
currentdir = boosty::stringy( fs::current_path() );
|
currentdir = boosty::stringy( fs::current_path() );
|
||||||
|
|
||||||
parser_init(boosty::stringy(fs::path(argv[0]).branch_path()), false);
|
parser_init(boosty::stringy(fs::path(argv[0]).branch_path()));
|
||||||
add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries"));
|
add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries"));
|
||||||
|
|
||||||
ModuleContext top_ctx;
|
ModuleContext top_ctx;
|
||||||
|
|
|
@ -73,7 +73,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
currentdir = boosty::stringy( fs::current_path() );
|
currentdir = boosty::stringy( fs::current_path() );
|
||||||
|
|
||||||
parser_init(boosty::stringy(fs::path(argv[0]).branch_path()), false);
|
parser_init(boosty::stringy(fs::path(argv[0]).branch_path()));
|
||||||
add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries"));
|
add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries"));
|
||||||
|
|
||||||
ModuleContext top_ctx;
|
ModuleContext top_ctx;
|
||||||
|
|
Loading…
Reference in New Issue