diff options
| author | ruki <[email protected]> | 2017-06-19 21:16:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-19 21:23:00 +0800 |
| commit | 1e7d8c44b51528b129c9d600785fd7a84850646b (patch) | |
| tree | b86fcb28091ba83a3f5dc4b0485163a2e3c759f6 /xmake/modules/lib/detect/find_toolname.lua | |
| parent | e2d960162cd7c78eaa86ae3fc474a112ec4ddfbe (diff) | |
impl has_flags and rename detect.xxx to detect.xxxs
Diffstat (limited to 'xmake/modules/lib/detect/find_toolname.lua')
| -rw-r--r-- | xmake/modules/lib/detect/find_toolname.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/xmake/modules/lib/detect/find_toolname.lua b/xmake/modules/lib/detect/find_toolname.lua index 1d8ce4d04..ce3b4f1f1 100644 --- a/xmake/modules/lib/detect/find_toolname.lua +++ b/xmake/modules/lib/detect/find_toolname.lua @@ -25,6 +25,14 @@ -- find tool name from the given program function _find(program) + -- get tool directory + local tooldir = path.join(os.programdir(), "modules", "detect", "tools") + + -- attempt to find it directly first + if os.isfile(path.join(tooldir, "find_" .. program .. ".lua")) then + return program + end + -- get file name first name = path.filename(program):lower() @@ -40,9 +48,6 @@ function _find(program) -- remove suffix: ".xxx" name = name:gsub("%.%w+", "") - -- get tool directory - local tooldir = path.join(os.programdir(), "modules", "detect", "tool") - -- find_toolname.lua exists? found local toolname = name:gsub("[%+%-]", function (ch) return ifelse(ch == "+", "x", "_") end) if os.isfile(path.join(tooldir, "find_" .. toolname .. ".lua")) then |
