Переглянути джерело

Merge pull request #23355 from buresu/fix-gdnative-loading-on-mac

GDNative: Fixes a library path problem after exporting app for OSX
Rémi Verschelde 6 роки тому
батько
коміт
5e999414d3
1 змінених файлів з 7 додано та 0 видалено
  1. 7 0
      modules/gdnative/gdnative.cpp

+ 7 - 0
modules/gdnative/gdnative.cpp

@@ -306,6 +306,13 @@ bool GDNative::initialize() {
 #elif defined(UWP_ENABLED)
 #elif defined(UWP_ENABLED)
 	// On UWP we use a relative path from the app
 	// On UWP we use a relative path from the app
 	String path = lib_path.replace("res://", "");
 	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
 #else
 	String path = ProjectSettings::get_singleton()->globalize_path(lib_path);
 	String path = ProjectSettings::get_singleton()->globalize_path(lib_path);
 #endif
 #endif