diff options
| author | Colin Davidson <colrdavidson@gmail.com> | 2022-02-24 01:13:51 -0800 |
|---|---|---|
| committer | Colin Davidson <colrdavidson@gmail.com> | 2022-02-24 01:13:51 -0800 |
| commit | aeaf1199ec8f9ac8b86bd71f17067dbcb734ea48 (patch) | |
| tree | ab7cedd58ba8d8d79c6e90e1a0ad94a842bcea9d | |
| parent | dd0d61e97cc20956bc4c84e8c203653e22992738 (diff) | |
Add make_directory so darwin can build html docs
| -rw-r--r-- | core/os/os_darwin.odin | 10 |
1 files changed, 10 insertions, 0 deletions
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)) } |