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
|
||||
const std::string application_path = boosty::stringy(boosty::absolute(boost::filesystem::path(argv[0]).parent_path()));
|
||||
#endif
|
||||
parser_init(application_path, false);
|
||||
parser_init(application_path);
|
||||
Tree tree;
|
||||
#ifdef ENABLE_CGAL
|
||||
CGALEvaluator cgalevaluator(tree);
|
||||
|
@ -516,7 +516,7 @@ int gui(vector<string> &inputFiles, const fs::path &original_path, int argc, cha
|
|||
qexamplesdir = exdir.path();
|
||||
}
|
||||
MainWindow::setExamplesDir(qexamplesdir);
|
||||
parser_init(app_path.toLocal8Bit().constData(), true);
|
||||
parser_init(app_path.toLocal8Bit().constData());
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
installAppleEventHandlers();
|
||||
|
|
|
@ -88,7 +88,7 @@ fs::path find_valid_path(const fs::path &sourcepath,
|
|||
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
|
||||
const char *openscadpaths = getenv("OPENSCADPATH");
|
||||
|
@ -117,7 +117,8 @@ void parser_init(const std::string &applicationpath, bool isgui)
|
|||
fs::path tmpdir;
|
||||
#ifdef __APPLE__
|
||||
// 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";
|
||||
if (!is_directory(libdir / "libraries")) libdir /= "../../..";
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
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);
|
||||
fs::path search_libs(const fs::path &localpath);
|
||||
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());
|
||||
|
||||
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"));
|
||||
|
||||
ModuleContext top_ctx;
|
||||
|
|
|
@ -77,7 +77,7 @@ int main(int argc, char **argv)
|
|||
|
||||
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"));
|
||||
|
||||
ModuleContext top_ctx;
|
||||
|
|
|
@ -73,7 +73,7 @@ int main(int argc, char **argv)
|
|||
|
||||
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"));
|
||||
|
||||
ModuleContext top_ctx;
|
||||
|
|
Loading…
Reference in New Issue