diff options
| author | ruki <[email protected]> | 2025-10-11 15:55:56 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-10-11 15:55:56 +0800 |
| commit | c666f0560bbb68d062c57923821607c2d893340e (patch) | |
| tree | c1b4e3a19ce1291769834aa84853e0228151580f /core/src | |
| parent | b3bc1f49a705b8b1a15d14194a239f43be17a95d (diff) | |
add copy_if_different for os.cp
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/xmake/os/cpdir.c | 4 | ||||
| -rw-r--r-- | core/src/xmake/os/cpfile.c | 4 |
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; |
