diff options
| author | ruki <[email protected]> | 2018-05-02 22:53:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-05-02 11:23:17 +0800 |
| commit | 0bafe409d0687ebd429037907f15617fe4b42d53 (patch) | |
| tree | 102b1e177bc7eb2ca3b2471a55f99fdc2bee3dd6 | |
| parent | d1db6a9b8cc657ea5b3fc1cddb52d3b351639680 (diff) | |
modify os.match
| -rw-r--r-- | xmake/core/base/os.lua | 2 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/os.lua | 24 |
2 files changed, 9 insertions, 17 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index 679ac50fa..fba49b64d 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -286,7 +286,7 @@ end -- -- @note only return {} without count to simplify code, .e.g unpack(os.dirs("")) -- -function os.dirs(pattern, ...) +function os.dirs(pattern) return (os.match(pattern, 'd')) end diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua index 77e55450f..b75df1d66 100644 --- a/xmake/core/sandbox/modules/os.lua +++ b/xmake/core/sandbox/modules/os.lua @@ -385,31 +385,23 @@ function sandbox_os.execv(program, argv, opt) end -- match files or directories -function sandbox_os.match(pattern, mode, ...) - - -- check - assert(pattern) - - -- format it first - pattern = vformat(pattern, ...) - - -- match it - return os.match(pattern, mode) +function sandbox_os.match(pattern, mode) + return os.match(vformat(pattern), mode) end -- match directories -function sandbox_os.dirs(pattern, ...) - return sandbox_os.match(pattern, 'd', ...) +function sandbox_os.dirs(pattern) + return sandbox_os.match(pattern, 'd') end -- match files -function sandbox_os.files(pattern, ...) - return sandbox_os.match(pattern, 'f', ...) +function sandbox_os.files(pattern) + return sandbox_os.match(pattern, 'f') end -- match files and directories -function sandbox_os.filedirs(pattern, ...) - return sandbox_os.match(pattern, 'a', ...) +function sandbox_os.filedirs(pattern) + return sandbox_os.match(pattern, 'a') end -- is directory? |
