libobs/util: Flush text files when writing
Helps prevent the possibility of an empty file from being written.
This commit is contained in:
parent
6d3777129d
commit
ac2f792d50
@ -248,6 +248,7 @@ bool os_quick_write_mbs_file(const char *path, const char *str, size_t len)
|
||||
if (mbs_len)
|
||||
fwrite(mbs, 1, mbs_len, f);
|
||||
bfree(mbs);
|
||||
fflush(f);
|
||||
fclose(f);
|
||||
|
||||
return true;
|
||||
@ -264,6 +265,7 @@ bool os_quick_write_utf8_file(const char *path, const char *str, size_t len,
|
||||
fwrite("\xEF\xBB\xBF", 1, 3, f);
|
||||
if (len)
|
||||
fwrite(str, 1, len, f);
|
||||
fflush(f);
|
||||
fclose(f);
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user