From 63cba9ba627c9d7e1d167600006cf3358dfee345 Mon Sep 17 00:00:00 2001 From: Naoto Kondo Date: Sun, 28 Oct 2018 00:58:04 +0900 Subject: [PATCH] GDNative: Fixes a problem that active_library_path is wrong after exporting app for mac --- modules/gdnative/gdnative.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index ecde73ae1ca..283e9b3bc8d 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