summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-11-20 23:55:48 +0800
committerruki <[email protected]>2017-11-20 17:34:50 +0800
commit42049c851729f8e93276ac3aec8042913f6d899d (patch)
treede6f0e43f06453fb24edf53a0596582ebba6f85d
parenta28b1f657d8cdf855fca8d0ab6a5af5092f164eb (diff)
add unpack in xmake.lua
-rw-r--r--xmake/core/base/os.lua9
-rw-r--r--xmake/core/sandbox/modules/interpreter/unpack.lua27
2 files changed, 33 insertions, 3 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 6275c4e15..296b3ec01 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -283,18 +283,21 @@ function os.match(pattern, mode)
end
-- match directories
+--
+-- @note only return {} without count to simplify code, .e.g unpack(os.dirs(""))
+--
function os.dirs(pattern, ...)
- return os.match(pattern, 'd')
+ return (os.match(pattern, 'd'))
end
-- match files
function os.files(pattern)
- return os.match(pattern, 'f')
+ return (os.match(pattern, 'f'))
end
-- match files and directories
function os.filedirs(pattern)
- return os.match(pattern, 'a')
+ return (os.match(pattern, 'a'))
end
-- copy files or directories
diff --git a/xmake/core/sandbox/modules/interpreter/unpack.lua b/xmake/core/sandbox/modules/interpreter/unpack.lua
new file mode 100644
index 000000000..863aac397
--- /dev/null
+++ b/xmake/core/sandbox/modules/interpreter/unpack.lua
@@ -0,0 +1,27 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file unpack.lua
+--
+
+-- load module
+return unpack
+