diff options
| author | ruki <[email protected]> | 2018-08-15 00:52:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-08-14 23:17:23 +0800 |
| commit | ed14c315818bc197f762f82b522a206162952abf (patch) | |
| tree | d7fe82fc47b3263b37feed423c27d64e9ff8e90d | |
| parent | 209263cc742c40416da46cf1af5f63a8a9a59df4 (diff) | |
fix os.fscase() bug
| -rw-r--r-- | xmake/core/base/os.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index c0f86c805..fd6ca4234 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -861,8 +861,17 @@ function os.fscase() -- get temporary directory local tmpdir = os.tmpdir() + -- get matching pattern, this is equal to os.filedirs(path.join(tmpdir, "*")) + -- + -- @note we cannot use os.match() becase os.fscase() will be called in os.match() + -- + local pattern = path.join(tmpdir, "*") + pattern = pattern:gsub("([%+%.%-%^%$%(%)%%])", "%%%1") + pattern = pattern:gsub("%*", "\002") + pattern = pattern:gsub("\002", "[^/]*") + -- attempt to detect it - local file = os.filedirs(path.join(tmpdir, "**"), function (file, isdir) return false end) + local file = os.find(tmpdir, pattern, 0, -1, nil, function (file, isdir) return false end) if file and #file > 0 then local file1 = file[1] local file2 = file1:gsub(".", function (ch) return (ch >= 'a' and ch <= 'z') and ch:upper() or ch:lower() end) |
