diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-02 18:06:17 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-02 18:06:17 +0100 |
commit | 37df2ff38708187366539240bbcaebeef0ee2928 (patch) | |
tree | 3e15ce620d38c392999afa4143928b6fa9bff1fb /platform | |
parent | b4b96ab4e377553a95500e1e682a113454acc485 (diff) | |
parent | fe6b07381189adb57dbc78150eab602044d541d0 (diff) | |
download | redot-engine-37df2ff38708187366539240bbcaebeef0ee2928.tar.gz |
Merge pull request #86682 from Daylily-Zeleen/daylily-zeleen/distinguish_between_dynamic_libaray_not_found_and_can't_open
Distinguish between dynamic library not found and can't be opened.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/os_android.cpp | 2 | ||||
-rw-r--r-- | platform/ios/os_ios.mm | 2 | ||||
-rw-r--r-- | platform/macos/os_macos.mm | 2 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 2 |
4 files changed, 8 insertions, 0 deletions
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 0d82bec75d..35d4222152 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -170,6 +170,8 @@ Error OS_Android::open_dynamic_library(const String p_path, void *&p_library_han so_file_exists = false; } + ERR_FAIL_COND_V(!FileAccess::exists(path), ERR_FILE_NOT_FOUND); + p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW); if (!p_library_handle && so_file_exists) { // The library may be on the sdcard and thus inaccessible. Try to copy it to the internal diff --git a/platform/ios/os_ios.mm b/platform/ios/os_ios.mm index a646705305..80f1f4a5c2 100644 --- a/platform/ios/os_ios.mm +++ b/platform/ios/os_ios.mm @@ -257,6 +257,8 @@ Error OS_IOS::open_dynamic_library(const String p_path, void *&p_library_handle, path = get_framework_executable(get_executable_path().get_base_dir().path_join("Frameworks").path_join(p_path.get_file().get_basename() + ".framework")); } + ERR_FAIL_COND_V(!FileAccess::exists(path), ERR_FILE_NOT_FOUND); + p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW); ERR_FAIL_NULL_V_MSG(p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror())); diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm index 29dff683d5..b8496d72fb 100644 --- a/platform/macos/os_macos.mm +++ b/platform/macos/os_macos.mm @@ -230,6 +230,8 @@ Error OS_MacOS::open_dynamic_library(const String p_path, void *&p_library_handl path = get_framework_executable(get_executable_path().get_base_dir().path_join("../Frameworks").path_join(p_path.get_file())); } + ERR_FAIL_COND_V(!FileAccess::exists(path), ERR_FILE_NOT_FOUND); + p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW); ERR_FAIL_NULL_V_MSG(p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror())); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 3d664a28da..6ad616da85 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -360,6 +360,8 @@ Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_han path = get_executable_path().get_base_dir().path_join(p_path.get_file()); } + ERR_FAIL_COND_V(!FileAccess::exists(path), ERR_FILE_NOT_FOUND); + typedef DLL_DIRECTORY_COOKIE(WINAPI * PAddDllDirectory)(PCWSTR); typedef BOOL(WINAPI * PRemoveDllDirectory)(DLL_DIRECTORY_COOKIE); |