1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Add GDNative Framework loading and export support.

This commit is contained in:
bruvzg
2021-03-10 10:32:05 +02:00
parent 6aa8f7d85b
commit 53f05c9167
4 changed files with 71 additions and 9 deletions

View File

@@ -32,6 +32,7 @@
#include "core/global_constants.h"
#include "core/io/file_access_encrypted.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
#include "core/project_settings.h"
@@ -325,9 +326,18 @@ bool GDNative::initialize() {
// On OSX the exported libraries are located under the Frameworks directory.
// So we need to replace the library path.
String path = ProjectSettings::get_singleton()->globalize_path(lib_path);
if (!FileAccess::exists(path)) {
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (!da->file_exists(path) && !da->dir_exists(path)) {
path = OS::get_singleton()->get_executable_path().get_base_dir().plus_file("../Frameworks").plus_file(lib_path.get_file());
}
if (da->dir_exists(path)) { // Target library is a ".framework", add library base name to the path.
path = path.plus_file(path.get_file().get_basename());
}
memdelete(da);
#else
String path = ProjectSettings::get_singleton()->globalize_path(lib_path);
#endif