summaryrefslogtreecommitdiff
path: root/drivers/unix
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/unix')
-rw-r--r--drivers/unix/file_access_unix.cpp2
-rw-r--r--drivers/unix/os_unix.cpp6
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index a7a3eef935..57826828ae 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -136,7 +136,7 @@ void FileAccessUnix::close() {
if (save_path != "") {
//unlink(save_path.utf8().get_data());
- //print_line("renaming..");
+ //print_line("renaming...");
int rename_error = rename((save_path + ".tmp").utf8().get_data(), save_path.utf8().get_data());
if (rename_error && close_fail_notify) {
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 31c8e4ade9..eeb3b31fc2 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -349,6 +349,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());