Handle the MacOS application layout when finding resources.

master
Torsten Paul 2014-01-07 19:47:31 +01:00
parent ee4b2ffef5
commit a512a6442e
1 changed files with 9 additions and 1 deletions

View File

@ -20,8 +20,16 @@ fs::path get_resource_dir(const std::string &resource_folder)
if (!fs::is_directory(applicationdir)) {
return fs::path();
}
fs::path basepath(applicationdir);
#ifdef __APPLE__
fs::path bundlepath = basepath.parent_path().parent_path();
if (bundlepath.filename().string() == "OpenSCAD.app") {
basepath = bundlepath / "Contents" / "Resources";
}
#endif
fs::path resource_dir = fs::path(applicationdir) / resource_folder;
fs::path resource_dir = basepath / resource_folder;
if (!fs::is_directory(resource_dir)) {
return fs::path();
}