summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-02-17 21:18:27 +0800
committerruki <[email protected]>2017-02-17 21:18:27 +0800
commitf40e78236da8c17d9417da88b8cf077c03a38fa8 (patch)
tree7cb93be640835eb10fe8b5b9cbb964fc5c6fde95
parentd198f05685c745be00517f2838dadc4fa18e7808 (diff)
fix os.match for relative path
-rwxr-xr-xcore/src/xmake/os/find.c4
-rw-r--r--xmake/core/base/os.lua5
2 files changed, 4 insertions, 5 deletions
diff --git a/core/src/xmake/os/find.c b/core/src/xmake/os/find.c
index 4cca6605c..ea847f195 100755
--- a/core/src/xmake/os/find.c
+++ b/core/src/xmake/os/find.c
@@ -51,6 +51,10 @@ static tb_bool_t xm_os_find_walk(tb_char_t const* path, tb_file_info_t const* in
tb_char_t const* pattern = (tb_char_t const*)tuple[1].cstr;
tb_assert_and_check_return_val(pattern, tb_false);
+ // remove ./ for path
+ if (path[0] == '.' && (path[1] == '/' || path[1] == '\\'))
+ path = path + 2;
+
// the match mode
tb_long_t mode = tuple[2].l;
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 40527b587..f6e1463f0 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -200,11 +200,6 @@ function os.match(pattern, mode)
pattern = pattern:gsub("\001", ".*")
pattern = pattern:gsub("\002", "[^/]*")
- -- patch "./" for matching ok if root directory is '.'
- if rootdir == '.' then
- pattern = "." .. path.seperator() .. pattern
- end
-
-- translate mode
if type(mode) == "string" then
local modes = {a = -1, f = 0, d = 1}