From: Brendan Hansen Date: Mon, 11 Dec 2023 02:23:30 +0000 (-0600) Subject: fixed: `CreateDirectoryA` on windows X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=2b6e9e8cd7be731de4d73cd365ce47d88380e1ef;p=onyx.git fixed: `CreateDirectoryA` on windows --- diff --git a/core/os/dir.onyx b/core/os/dir.onyx index c423bb80..2cd83ed3 100644 --- a/core/os/dir.onyx +++ b/core/os/dir.onyx @@ -5,6 +5,7 @@ package core.os } use core.string +use core.conv use runtime #local fs :: runtime.platform @@ -79,7 +80,7 @@ remove_directory :: (path: str) -> bool { full_path_buffer: [512] u8; for list_directory(path) { - full_path := string.concat(full_path_buffer, path, "/", it->name()); + full_path := conv.format(full_path_buffer, "{}{}{}", path, PATH_SEP, it->name()); if it.type == .Directory { if !remove_directory(full_path) do return false; diff --git a/runtime/src/ort_directories.h b/runtime/src/ort_directories.h index d5d37e29..a2285246 100644 --- a/runtime/src/ort_directories.h +++ b/runtime/src/ort_directories.h @@ -137,7 +137,7 @@ ONYX_DEF(__dir_create, (WASM_I32, WASM_I32), (WASM_I32)) { path[path_len] = 0; #ifdef _BH_WINDOWS - results->data[0] = WASM_I32_VAL(CreateDirectoryA(path)); + results->data[0] = WASM_I32_VAL(CreateDirectoryA(path, NULL)); return NULL; #endif diff --git a/shared/include/small_windows.h b/shared/include/small_windows.h index d25a08dc..a3c4924a 100644 --- a/shared/include/small_windows.h +++ b/shared/include/small_windows.h @@ -420,7 +420,7 @@ GB_DLL_IMPORT BOOL WINAPI GetFileAttributesExW(wchar_t const *path, GET_FILEEX GB_DLL_IMPORT BOOL WINAPI CopyFileW(wchar_t const *old_f, wchar_t const *new_f, BOOL fail_if_exists); GB_DLL_IMPORT BOOL WINAPI MoveFileW(wchar_t const *old_f, wchar_t const *new_f); GB_DLL_IMPORT BOOL WINAPI DeleteFileA (char const *path); -GB_DLL_IMPORT BOOL WINAPI CreateDirectoryA(char const *path); +GB_DLL_IMPORT BOOL WINAPI CreateDirectoryA(char const *path, SECURITY_ATTRIBUTES *lpSecurityAttributes); GB_DLL_IMPORT BOOL WINAPI RemoveDirectoryA(char const *path); GB_DLL_IMPORT BOOL WINAPI MoveFileA (char const *old_path, char const *new_path);