From 7500660d807b88f012cef16912dfcca3a9919c2e Mon Sep 17 00:00:00 2001 From: Young-Flash Date: Fri, 24 Jan 2025 17:24:46 +0800 Subject: [PATCH] fix: windows fopen mode should end with \x00 --- fs_sync/fs_sync_native.mbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs_sync/fs_sync_native.mbt b/fs_sync/fs_sync_native.mbt index adec7986e..dfe1dccd7 100644 --- a/fs_sync/fs_sync_native.mbt +++ b/fs_sync/fs_sync_native.mbt @@ -59,7 +59,7 @@ fn get_error_message() -> String { ///| fn read_file_to_bytes_internal(path : String) -> Bytes! { - let file = fopen_ffi(mbt_string_to_utf8_bytes(path, true), b"rb") + let file = fopen_ffi(mbt_string_to_utf8_bytes(path, true), b"rb\x00") guard is_null(file) == 0 else { raise IOError(get_error_message()) } guard fseek_ffi(file, 0, 2) == 0 else { raise IOError(get_error_message()) } let size = ftell_ffi(file) @@ -87,7 +87,7 @@ fn read_file_to_string_internal( ///| fn write_bytes_to_file_internal(path : String, content : Bytes) -> Unit! { - let file = fopen_ffi(mbt_string_to_utf8_bytes(path, true), b"wb") + let file = fopen_ffi(mbt_string_to_utf8_bytes(path, true), b"wb\x00") guard is_null(file) == 0 else { raise IOError(get_error_message()) } let bytes_written = fwrite_ffi(content, 1, content.length(), file) guard bytes_written == content.length() else {