summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-02-08 20:40:34 +0800
committerruki <[email protected]>2017-02-08 20:40:34 +0800
commitf717d2da6d60566cfe84737950b311b4d7af9275 (patch)
treee2250e917c8e8064a84da8bd5d491c375fd3fc50 /xmake/core/sandbox/modules/os.lua
parentf32315b12be847b6231b025388d72c6b529313c4 (diff)
improve os.cp
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
-rw-r--r--xmake/core/sandbox/modules/os.lua16
1 files changed, 7 insertions, 9 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 26c6b40bd..f45e68d83 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -39,21 +39,19 @@ sandbox_os.mtime = os.mtime
sandbox_os.mclock = os.mclock
-- copy file or directory
-function sandbox_os.cp(src, dst)
+function sandbox_os.cp(...)
- -- check
- assert(src and dst)
-
- -- format it first
- src = vformat(src)
- dst = vformat(dst)
+ -- format arguments
+ local args = {}
+ for _, arg in ipairs({...}) do
+ table.insert(args, vformat(arg))
+ end
-- done
- local ok, errors = os.cp(src, dst)
+ local ok, errors = os.cp(unpack(args))
if not ok then
os.raise(errors)
end
-
end
-- move file or directory