From e744959de54dcb2f46bd7b1dc084a96ef8a05071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=A0achov?= Date: Sat, 16 May 2026 18:06:15 +0200 Subject: [PATCH] avoiding an incorrect ERR_FILE_NOT_FOUND report when the DLL exists but fails to load for another reason Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com> --- core/extension/gdextension_library_loader.cpp | 3 +++ platform/windows/os_windows.cpp | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/extension/gdextension_library_loader.cpp b/core/extension/gdextension_library_loader.cpp index b35567305b..439fddfcbf 100644 --- a/core/extension/gdextension_library_loader.cpp +++ b/core/extension/gdextension_library_loader.cpp @@ -200,7 +200,10 @@ Error GDExtensionLibraryLoader::open_library(const String &p_path) { // Apple has a complex lookup system which goes beyond looking up the filename, so we try that first. err = OS::get_singleton()->open_dynamic_library(abs_path, library, &data); if (err != OK) { +#ifdef APPLE_EMBEDDED_ENABLED err = OS::get_singleton()->open_dynamic_library(String(), library, &data); +#endif + if (err != OK) { return err; } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 04d4783ef9..1cf034bf48 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -480,12 +480,11 @@ Error OS_Windows::open_dynamic_library(const String &p_path, void *&p_library_ha if (!FileAccess::exists(path)) { //this code exists so gdextension can load .dll files from within the executable path path = get_executable_path().get_base_dir().path_join(p_path.get_file()); + ERR_FAIL_COND_V(!FileAccess::exists(path), ERR_FILE_NOT_FOUND); } // Path to load from may be different from original if we make copies. String load_path = path; - ERR_FAIL_COND_V(!FileAccess::exists(path), ERR_FILE_NOT_FOUND); - // Here we want a copy to be loaded. // This is so the original file isn't locked and can be updated by a compiler. if (p_data != nullptr && p_data->generate_temp_files) {