summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/xmake/os/cpdir.c4
-rw-r--r--core/src/xmake/os/cpfile.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/core/src/xmake/os/cpdir.c b/core/src/xmake/os/cpdir.c
index 4fee30903..cdae6f173 100644
--- a/core/src/xmake/os/cpdir.c
+++ b/core/src/xmake/os/cpdir.c
@@ -49,6 +49,10 @@ tb_int_t xm_os_cpdir(lua_State* lua)
if (is_symlink)
flags |= TB_FILE_COPY_LINK;
+ tb_bool_t copy_if_different = lua_toboolean(lua, 4);
+ if (copy_if_different)
+ flags |= TB_FILE_COPY_IF_DIFFERENT;
+
// do copy
lua_pushboolean(lua, tb_directory_copy(src, dst, flags));
return 1;
diff --git a/core/src/xmake/os/cpfile.c b/core/src/xmake/os/cpfile.c
index 75b09ba28..7c2c312ce 100644
--- a/core/src/xmake/os/cpfile.c
+++ b/core/src/xmake/os/cpfile.c
@@ -53,6 +53,10 @@ tb_int_t xm_os_cpfile(lua_State* lua)
if (is_writeable)
flags |= TB_FILE_COPY_WRITEABLE;
+ tb_bool_t copy_if_different = lua_toboolean(lua, 5);
+ if (copy_if_different)
+ flags |= TB_FILE_COPY_IF_DIFFERENT;
+
// do copy
lua_pushboolean(lua, tb_file_copy(src, dst, flags));
return 1;