diff options
author | Emmanuel Leblond <emmanuel.leblond@gmail.com> | 2022-04-29 00:51:04 +0200 |
---|---|---|
committer | Emmanuel Leblond <emmanuel.leblond@gmail.com> | 2022-04-29 00:51:04 +0200 |
commit | 80f61352fb1b0bed251c06eb0a21a09374de77b3 (patch) | |
tree | 37e9cfe46ecd8757d3b21af2daea679194acccbf /drivers/unix | |
parent | 574bf0b91b848e6369d0a07a611d4decf88e668b (diff) |
Add GDNativeInterface::get_library_path to GDExtension
Diffstat (limited to 'drivers/unix')
-rw-r--r-- | drivers/unix/os_unix.cpp | 7 | ||||
-rw-r--r-- | drivers/unix/os_unix.h | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 3b5e1bf91d..12e2113364 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -429,7 +429,7 @@ String OS_Unix::get_locale() const { return locale; } -Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) { +Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) { String path = p_path; if (FileAccess::exists(path) && path.is_relative_path()) { @@ -450,6 +450,11 @@ Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW); ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ". Error: " + dlerror()); + + if (r_resolved_path != nullptr) { + *r_resolved_path = path; + } + return OK; } diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index 460ba4b9e1..6116574528 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -55,7 +55,7 @@ public: virtual Error get_entropy(uint8_t *r_buffer, int p_bytes) override; // Should return cryptographycally-safe random bytes. - virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) override; + virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) override; virtual Error close_dynamic_library(void *p_library_handle) override; virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) override; |