GDNative Unix: fix shared lib loading, dlopen expects leading ./ to interpret as relative path.
(cherry picked from commit 8287441955
)
This commit is contained in:
parent
01e64eb247
commit
4866733a74
1 changed files with 6 additions and 0 deletions
|
@ -357,6 +357,12 @@ Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle
|
|||
|
||||
String path = p_path;
|
||||
|
||||
if (FileAccess::exists(path) && path.is_rel_path()) {
|
||||
// dlopen expects a slash, in this case a leading ./ for it to be interpreted as a relative path,
|
||||
// otherwise it will end up searching various system directories for the lib instead and finally failing.
|
||||
path = "./" + path;
|
||||
}
|
||||
|
||||
if (!FileAccess::exists(path)) {
|
||||
//this code exists so gdnative can load .so files from within the executable path
|
||||
path = get_executable_path().get_base_dir().plus_file(p_path.get_file());
|
||||
|
|
Loading…
Reference in a new issue