summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-31 22:39:10 +0800
committerruki <[email protected]>2022-08-31 22:39:10 +0800
commit44d9b7cd8ef84a84bd8d898dddc419c385e02daf (patch)
tree045b46d2029d30f092494887f8857bccc72cd5a2 /core/src
parentdf6efbec2309e41c67e6ffdc8386a600ca04c21d (diff)
improve os.cpfile
Diffstat (limited to 'core/src')
m---------core/src/tbox/tbox0
-rw-r--r--core/src/xmake/os/cpfile.c8
2 files changed, 7 insertions, 1 deletions
diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox
-Subproject 4ab2cdf8dc94402d2277fd71ddc11eae913a30d
+Subproject 6e4eab7e07a2b535af6889de3f62cfec0384e99
diff --git a/core/src/xmake/os/cpfile.c b/core/src/xmake/os/cpfile.c
index 4490172da..153f51de0 100644
--- a/core/src/xmake/os/cpfile.c
+++ b/core/src/xmake/os/cpfile.c
@@ -43,7 +43,13 @@ tb_int_t xm_os_cpfile(lua_State* lua)
tb_char_t const* dst = luaL_checkstring(lua, 2);
tb_check_return_val(src && dst, 0);
+ // init copy flags
+ tb_size_t flags = TB_FILE_COPY_NONE;
+ tb_bool_t is_symlink = lua_toboolean(lua, 3);
+ if (is_symlink)
+ flags |= TB_FILE_COPY_LINK;
+
// do copy
- lua_pushboolean(lua, tb_file_copy(src, dst));
+ lua_pushboolean(lua, tb_file_copy(src, dst, flags));
return 1;
}