Skip to content

Commit 00680b5

Browse files
committed
fix: windows fopen mode should end with \x00
1 parent 4a4d40f commit 00680b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs_sync/fs_sync_native.mbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn get_error_message() -> String {
5959

6060
///|
6161
fn read_file_to_bytes_internal(path : String) -> Bytes! {
62-
let file = fopen_ffi(mbt_string_to_utf8_bytes(path, true), b"rb")
62+
let file = fopen_ffi(mbt_string_to_utf8_bytes(path, true), b"rb\x00")
6363
guard is_null(file) == 0 else { raise IOError(get_error_message()) }
6464
guard fseek_ffi(file, 0, 2) == 0 else { raise IOError(get_error_message()) }
6565
let size = ftell_ffi(file)
@@ -87,7 +87,7 @@ fn read_file_to_string_internal(
8787

8888
///|
8989
fn write_bytes_to_file_internal(path : String, content : Bytes) -> Unit! {
90-
let file = fopen_ffi(mbt_string_to_utf8_bytes(path, true), b"wb")
90+
let file = fopen_ffi(mbt_string_to_utf8_bytes(path, true), b"wb\x00")
9191
guard is_null(file) == 0 else { raise IOError(get_error_message()) }
9292
let bytes_written = fwrite_ffi(content, 1, content.length(), file)
9393
guard bytes_written == content.length() else {

0 commit comments

Comments
 (0)