diff options
Diffstat (limited to 'modules/mono/editor/editor_internal_calls.cpp')
-rw-r--r-- | modules/mono/editor/editor_internal_calls.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/mono/editor/editor_internal_calls.cpp b/modules/mono/editor/editor_internal_calls.cpp index 443b4ba841..48a3259a90 100644 --- a/modules/mono/editor/editor_internal_calls.cpp +++ b/modules/mono/editor/editor_internal_calls.cpp @@ -30,6 +30,10 @@ #include "editor_internal_calls.h" +#ifdef UNIX_ENABLED +#include <unistd.h> // access +#endif + #include "core/os/os.h" #include "core/version.h" #include "editor/editor_node.h" @@ -370,6 +374,15 @@ MonoString *godot_icall_Utils_OS_GetPlatformName() { return GDMonoMarshal::mono_string_from_godot(os_name); } +MonoBoolean godot_icall_Utils_OS_UnixFileHasExecutableAccess(MonoString *p_file_path) { +#ifdef UNIX_ENABLED + String file_path = GDMonoMarshal::mono_string_to_godot(p_file_path); + return access(file_path.utf8().get_data(), X_OK) == 0; +#else + ERR_FAIL_V(false); +#endif +} + void register_editor_internal_calls() { // GodotSharpDirs @@ -442,4 +455,5 @@ void register_editor_internal_calls() { // Utils.OS mono_add_internal_call("GodotTools.Utils.OS::GetPlatformName", (void *)godot_icall_Utils_OS_GetPlatformName); + mono_add_internal_call("GodotTools.Utils.OS::UnixFileHasExecutableAccess", (void *)godot_icall_Utils_OS_UnixFileHasExecutableAccess); } |