summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-10-29 10:38:55 +0100
committerGitHub <noreply@github.com>2018-10-29 10:38:55 +0100
commit5e999414d3c6779623e10f350c8f41547c26e866 (patch)
tree063cb8a9f6727f20c5f083b44d03411c1d412fcb
parentf7b6d41fe7e4b4eeedae6e639397fc56268cb769 (diff)
parent63cba9ba627c9d7e1d167600006cf3358dfee345 (diff)
Merge pull request #23355 from buresu/fix-gdnative-loading-on-mac
GDNative: Fixes a library path problem after exporting app for OSX
-rw-r--r--modules/gdnative/gdnative.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index ecde73ae1c..283e9b3bc8 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -306,6 +306,13 @@ bool GDNative::initialize() {
#elif defined(UWP_ENABLED)
// On UWP we use a relative path from the app
String path = lib_path.replace("res://", "");
+#elif defined(OSX_ENABLED)
+ // 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)) {
+ path = OS::get_singleton()->get_executable_path().get_base_dir().plus_file("../Frameworks").plus_file(lib_path.get_file());
+ }
#else
String path = ProjectSettings::get_singleton()->globalize_path(lib_path);
#endif