summaryrefslogtreecommitdiff
path: root/drivers/unix
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/unix')
-rw-r--r--drivers/unix/dir_access_unix.cpp6
-rw-r--r--drivers/unix/dir_access_unix.h1
-rw-r--r--drivers/unix/os_unix.cpp4
-rw-r--r--drivers/unix/thread_posix.cpp10
4 files changed, 14 insertions, 7 deletions
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 325a88b573..5b99a2f53f 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -152,7 +152,7 @@ String DirAccessUnix::get_next() {
_cisdir = (entry->d_type == DT_DIR);
}
- _cishidden = (fname != "." && fname != ".." && fname.begins_with("."));
+ _cishidden = is_hidden(fname);
return fname;
}
@@ -400,6 +400,10 @@ String DirAccessUnix::get_filesystem_type() const {
return ""; //TODO this should be implemented
}
+bool DirAccessUnix::is_hidden(const String &p_name) {
+ return p_name != "." && p_name != ".." && p_name.begins_with(".");
+}
+
DirAccessUnix::DirAccessUnix() {
dir_stream = nullptr;
_cisdir = false;
diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h
index b897efcafc..90f98d4705 100644
--- a/drivers/unix/dir_access_unix.h
+++ b/drivers/unix/dir_access_unix.h
@@ -51,6 +51,7 @@ class DirAccessUnix : public DirAccess {
protected:
virtual String fix_unicode_name(const char *p_name) const { return String::utf8(p_name); }
+ virtual bool is_hidden(const String &p_name);
public:
virtual Error list_dir_begin(); ///< This starts dir listing
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 6b98a344dc..96c338f86b 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -48,7 +48,7 @@
#include <mach/mach_time.h>
#endif
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#include <sys/param.h>
#include <sys/sysctl.h>
#endif
@@ -477,7 +477,7 @@ String OS_Unix::get_executable_path() const {
return OS::get_executable_path();
}
return b;
-#elif defined(__OpenBSD__)
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
char resolved_path[MAXPATHLEN];
realpath(OS::get_executable_path().utf8().get_data(), resolved_path);
diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp
index aa1b5019ca..285088342b 100644
--- a/drivers/unix/thread_posix.cpp
+++ b/drivers/unix/thread_posix.cpp
@@ -29,17 +29,17 @@
/*************************************************************************/
#include "thread_posix.h"
-#include "core/script_language.h"
#if (defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)) && !defined(NO_THREADS)
+#include "core/os/memory.h"
+#include "core/safe_refcount.h"
+#include "core/script_language.h"
+
#ifdef PTHREAD_BSD_SET_NAME
#include <pthread_np.h>
#endif
-#include "core/os/memory.h"
-#include "core/safe_refcount.h"
-
static void _thread_id_key_destr_callback(void *p_value) {
memdelete(static_cast<Thread::ID *>(p_value));
}
@@ -126,6 +126,8 @@ Error ThreadPosix::set_name_func_posix(const String &p_name) {
#ifdef PTHREAD_BSD_SET_NAME
pthread_set_name_np(running_thread, p_name.utf8().get_data());
int err = 0; // Open/FreeBSD ignore errors in this function
+#elif defined(PTHREAD_NETBSD_SET_NAME)
+ int err = pthread_setname_np(running_thread, "%s", const_cast<char *>(p_name.utf8().get_data()));
#else
int err = pthread_setname_np(running_thread, p_name.utf8().get_data());
#endif // PTHREAD_BSD_SET_NAME