summaryrefslogtreecommitdiff
path: root/xmake/core/base/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-05-21 09:17:02 +0800
committerruki <[email protected]>2017-05-21 09:17:02 +0800
commit23432a2befdc06cb2e48aea344c3ba0941d56490 (patch)
tree5ccdfeaf0dd974a1a2a0fd5465ae0eb3bf85665e /xmake/core/base/os.lua
parentb1470041c2eb3682b463e0f13192dd946416163c (diff)
fix os.mv to dir bug
Diffstat (limited to 'xmake/core/base/os.lua')
-rw-r--r--xmake/core/base/os.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 7827064e3..21bec949c 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -86,6 +86,12 @@ function os._mv(src, dst)
-- exists file or directory?
if os.exists(src) then
+
+ -- the destination directory exists? append the filename
+ if os.isdir(dst) then
+ dst = path.join(dst, path.filename(path.translate(src)))
+ end
+
-- move file or directory
if not os.rename(src, dst) then
return false, string.format("cannot move %s to %s %s", src, dst, os.strerror())