summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/base/os.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index fdbc3edbf..02e3b7838 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -82,6 +82,9 @@ function os._cp(src, dst, rootdir, opt)
-- link file if reserve symlink
if opt and opt.symlink and os.islink(src) then
local reallink = os.readlink(src)
+ if os.isfile(dst) then
+ os.rm(dst)
+ end
if not os.link(reallink, dst) then
return false, string.format("cannot link %s(%s) to %s, %s", src, reallink, dst, os.strerror())
end