summaryrefslogtreecommitdiff
path: root/core/src/xmake
diff options
context:
space:
mode:
authorruki <[email protected]>2019-07-10 23:11:47 +0800
committerruki <[email protected]>2019-07-10 13:10:46 +0800
commitac11149472ddf3da6918c7deec62059c7cec25e7 (patch)
treed37dec4a7821f51c22c1b4e3f909bf946b31a5eb /core/src/xmake
parente75bf9ac31aa544fd44a3e9da3bdcb4fd3d86004 (diff)
optimize to load lua file
Diffstat (limited to 'core/src/xmake')
-rw-r--r--core/src/xmake/io/file_close___gc.c2
-rw-r--r--core/src/xmake/io/file_flush.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/core/src/xmake/io/file_close___gc.c b/core/src/xmake/io/file_close___gc.c
index ebf74a63a..3ff136f6a 100644
--- a/core/src/xmake/io/file_close___gc.c
+++ b/core/src/xmake/io/file_close___gc.c
@@ -55,6 +55,7 @@ static tb_int_t xm_io_file_close_impl(lua_State* lua, tb_bool_t allow_closed_fil
// check
tb_assert(file->file_ref);
+#ifdef TB_CONFIG_OS_WINDOWS
// write cached data first
tb_byte_t const* odata = tb_buffer_data(&file->wcache);
tb_size_t osize = tb_buffer_size(&file->wcache);
@@ -63,6 +64,7 @@ static tb_int_t xm_io_file_close_impl(lua_State* lua, tb_bool_t allow_closed_fil
if (!tb_stream_bwrit(file->file_ref, odata, osize)) return tb_false;
tb_buffer_clear(&file->wcache);
}
+#endif
// close file
if (!tb_stream_clos(file->file_ref))
diff --git a/core/src/xmake/io/file_flush.c b/core/src/xmake/io/file_flush.c
index 8be57d5fc..ccab16310 100644
--- a/core/src/xmake/io/file_flush.c
+++ b/core/src/xmake/io/file_flush.c
@@ -45,6 +45,7 @@ static tb_bool_t xm_io_file_flush_impl(xm_io_file* file)
// check
tb_assert_and_check_return_val(xm_io_file_is_file(file) && !xm_io_file_is_closed(file), tb_false);
+#ifdef TB_CONFIG_OS_WINDOWS
// write cached data first
tb_byte_t const* odata = tb_buffer_data(&file->wcache);
tb_size_t osize = tb_buffer_size(&file->wcache);
@@ -53,6 +54,7 @@ static tb_bool_t xm_io_file_flush_impl(xm_io_file* file)
if (!tb_stream_bwrit(file->file_ref, odata, osize)) return tb_false;
tb_buffer_clear(&file->wcache);
}
+#endif
return tb_stream_sync(file->file_ref, tb_false);
}