fixed: `CreateDirectoryA` on windows
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 11 Dec 2023 02:23:30 +0000 (20:23 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 11 Dec 2023 02:23:30 +0000 (20:23 -0600)
core/os/dir.onyx
runtime/src/ort_directories.h
shared/include/small_windows.h

index c423bb80672250a17de00098dee44b5dc3e7a5bc..2cd83ed3251df5f4ccede1c783f270795eb2296c 100644 (file)
@@ -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;
index d5d37e298ef34b06517bf0f2832864aa7b5fe5bf..a22852465079d2477835cc7285c2f54d3a26ee7e 100644 (file)
@@ -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
 
index d25a08dcf4e1b63a9d06e85ca2521ade8f81bd16..a3c4924af726fd022883fadc6e17f8c48036e6ca 100644 (file)
@@ -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);