@@ -279,6 +279,11 @@ Rect2 fit_keep_aspect_covered(const Vector2 &p_container, const Vector2 &p_rect)
279279 path = get_framework_executable (get_executable_path ().get_base_dir ().path_join (p_path.get_file ().get_basename () + " .framework" ));
280280 }
281281
282+ if (!FileAccess::exists (path)) {
283+ // Load .dylib from within the executable path.
284+ path = get_framework_executable (get_executable_path ().get_base_dir ().path_join (p_path.get_file ().get_basename () + " .dylib" ));
285+ }
286+
282287 if (!FileAccess::exists (path)) {
283288 // Load .dylib or framework from a standard iOS location.
284289 path = get_framework_executable (get_executable_path ().get_base_dir ().path_join (" Frameworks" ).path_join (p_path.get_file ()));
@@ -289,8 +294,16 @@ Rect2 fit_keep_aspect_covered(const Vector2 &p_container, const Vector2 &p_rect)
289294 path = get_framework_executable (get_executable_path ().get_base_dir ().path_join (" Frameworks" ).path_join (p_path.get_file ().get_basename () + " .framework" ));
290295 }
291296
292- ERR_FAIL_COND_V (!FileAccess::exists (path), ERR_FILE_NOT_FOUND);
297+ if (!FileAccess::exists (path)) {
298+ // Load .dylib from a standard iOS location.
299+ path = get_framework_executable (get_executable_path ().get_base_dir ().path_join (" Frameworks" ).path_join (p_path.get_file ().get_basename () + " .dylib" ));
300+ }
293301
302+ if (!FileAccess::exists (path) && (p_path.ends_with (" .a" ) || p_path.ends_with (" .xcframework" ))) {
303+ path = String (); // Try loading static library.
304+ } else {
305+ ERR_FAIL_COND_V (!FileAccess::exists (path), ERR_FILE_NOT_FOUND);
306+ }
294307 p_library_handle = dlopen (path.utf8 ().get_data (), RTLD_NOW);
295308 ERR_FAIL_NULL_V_MSG (p_library_handle, ERR_CANT_OPEN, vformat (" Can't open dynamic library: %s. Error: %s." , p_path, dlerror ()));
296309
0 commit comments