From aeaf1199ec8f9ac8b86bd71f17067dbcb734ea48 Mon Sep 17 00:00:00 2001 From: Colin Davidson Date: Thu, 24 Feb 2022 01:13:51 -0800 Subject: [PATCH] Add make_directory so darwin can build html docs --- core/os/os_darwin.odin | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/os/os_darwin.odin b/core/os/os_darwin.odin index a011fa58a..c28db2865 100644 --- a/core/os/os_darwin.odin +++ b/core/os/os_darwin.odin @@ -313,6 +313,7 @@ foreign libc { @(link_name="getenv") _unix_getenv :: proc(cstring) -> cstring --- @(link_name="getcwd") _unix_getcwd :: proc(buf: cstring, len: c.size_t) -> cstring --- @(link_name="chdir") _unix_chdir :: proc(buf: cstring) -> c.int --- + @(link_name="mkdir") _unix_mkdir :: proc(buf: cstring, mode: u32) -> c.int --- @(link_name="realpath") _unix_realpath :: proc(path: cstring, resolved_path: rawptr) -> rawptr --- @(link_name="strerror") _darwin_string_error :: proc(num : c.int) -> cstring --- @@ -670,6 +671,15 @@ set_current_directory :: proc(path: string) -> (err: Errno) { return ERROR_NONE } +make_directory :: proc(path: string, mode: u32 = 0o775) -> Errno { + path_cstr := strings.clone_to_cstring(path, context.temp_allocator) + res := _unix_mkdir(path_cstr, mode) + if res == -1 { + return Errno(get_last_error()) + } + return ERROR_NONE +} + exit :: proc "contextless" (code: int) -> ! { _unix_exit(i32(code)) }