diff options
Diffstat (limited to 'drivers/unix/os_unix.cpp')
-rw-r--r-- | drivers/unix/os_unix.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 5f45f06c79..1e34d63b13 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -73,13 +73,21 @@ void OS_Unix::debug_break() { assert(false); }; -int OS_Unix::get_audio_driver_count() const { +static void handle_interrupt(int sig) { + if (ScriptDebugger::get_singleton() == NULL) + return; - return 1; + ScriptDebugger::get_singleton()->set_depth(-1); + ScriptDebugger::get_singleton()->set_lines_left(1); } -const char *OS_Unix::get_audio_driver_name(int p_driver) const { - return "dummy"; +void OS_Unix::initialize_debugging() { + + if (ScriptDebugger::get_singleton() != NULL) { + struct sigaction action; + action.sa_handler = handle_interrupt; + sigaction(SIGINT, &action, NULL); + } } int OS_Unix::unix_initialize_audio(int p_audio_driver) { @@ -98,10 +106,11 @@ void handle_sigchld(int sig) { void OS_Unix::initialize_core() { -#ifdef NO_PTHREADS +#ifdef NO_THREADS ThreadDummy::make_default(); SemaphoreDummy::make_default(); MutexDummy::make_default(); + RWLockDummy::make_default(); #else ThreadPosix::make_default(); SemaphorePosix::make_default(); @@ -296,7 +305,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo Vector<char *> args; for (int i = 0; i < cs.size(); i++) - args.push_back((char *)cs[i].get_data()); // shitty C cast + args.push_back((char *)cs[i].get_data()); args.push_back(0); execvp(p_path.utf8().get_data(), &args[0]); @@ -357,6 +366,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()); |