summaryrefslogtreecommitdiff
path: root/xmake/core/base
diff options
context:
space:
mode:
authorruki <[email protected]>2017-07-12 13:07:18 +0800
committerruki <[email protected]>2017-07-12 13:07:18 +0800
commitf6688e9eaff8ce02c097ba4e1da27d9efd8ece90 (patch)
tree00248715b7f53a9957d35d833fc4f3127a86f0f7 /xmake/core/base
parent7346528e00d1175b1ee4ce0c88234434a47a35ec (diff)
add os.args and fix command args
Diffstat (limited to 'xmake/core/base')
-rw-r--r--xmake/core/base/os.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 6616c2849..aeab699c4 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -156,6 +156,35 @@ function os.argw(argv)
return results
end
+-- make string from arguments list
+function os.args(argv)
+
+ -- make it
+ local args = nil
+ for _, arg in ipairs(argv) do
+ arg = arg:trim()
+ if #arg > 0 then
+ arg = arg:gsub("([\"\\])", "\\%1")
+ if arg:find("%s") then
+ if args then
+ args = args .. " \"" .. arg .. "\""
+ else
+ args = "\"" .. arg .. "\""
+ end
+ else
+ if args then
+ args = args .. " " .. arg
+ else
+ args = arg
+ end
+ end
+ end
+ end
+
+ -- ok?
+ return args or ""
+end
+
-- match files or directories
--
-- @param pattern the search pattern