Skip to content

Commit 3948f33

Browse files
twixussrexim
authored andcommitted
OPEN_ALWAYS -> CREATE_ALWAYS in nob_fd_open_for_write
Now `nob_fd_open_for_write` will clear the file before writing.
1 parent 21edd83 commit 3948f33

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nob.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ Nob_Fd nob_fd_open_for_write(const char *path)
10061006
GENERIC_WRITE, // open for writing
10071007
0, // do not share
10081008
&saAttr, // default security
1009-
OPEN_ALWAYS, // open always
1009+
CREATE_ALWAYS, // create always
10101010
FILE_ATTRIBUTE_NORMAL, // normal file
10111011
NULL // no attr. template
10121012
);
@@ -1935,6 +1935,7 @@ int closedir(DIR *dirp)
19351935
19361936
1.18.0 (2025-03-24) Add nob_da_foreach() (By @rexim)
19371937
Allow file sizes greater than 2GB to be read on windows (By @satchelfrost and @KillerxDBr)
1938+
Fix nob_fd_open_for_write behaviour on windows so it truncates the opened files (By @twixuss)
19381939
1.17.0 (2025-03-16) Factor out nob_da_reserve() (By @rexim)
19391940
Add nob_sb_appendf() (By @angelcaru)
19401941
1.16.1 (2025-03-16) Make nob_da_resize() exponentially grow capacity similar to no_da_append_many()

0 commit comments

Comments
 (0)