From 8294b15c930de7df43333dc1e93b019df93a73f8 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 31 Aug 2022 22:44:25 +0800 Subject: improve os.cp --- core/src/xmake/os/cpdir.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/xmake/os/cpdir.c b/core/src/xmake/os/cpdir.c index 1967cba49..eaf59f445 100644 --- a/core/src/xmake/os/cpdir.c +++ b/core/src/xmake/os/cpdir.c @@ -43,9 +43,13 @@ tb_int_t xm_os_cpdir(lua_State* lua) tb_char_t const* dst = luaL_checkstring(lua, 2); tb_check_return_val(src && dst, 0); - // done os.cpdir(src, dst) - lua_pushboolean(lua, tb_directory_copy(src, dst)); + // 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; - // ok + // do copy + lua_pushboolean(lua, tb_directory_copy(src, dst, flags)); return 1; } -- cgit v1.3.1