summaryrefslogtreecommitdiff
path: root/xmake/modules/lib/detect/find_toolname.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-07-17 23:24:16 +0800
committerruki <[email protected]>2017-07-17 23:24:34 +0800
commit7cac00bb9cace801c6db9758d2a01d2711738926 (patch)
tree40831686913090534c1e2b5ddb54399aa5b6bf11 /xmake/modules/lib/detect/find_toolname.lua
parent33144e73eae59ee7d934fd77673aac5a5a5cb0d1 (diff)
add add_moduledirs api and improve import
Diffstat (limited to 'xmake/modules/lib/detect/find_toolname.lua')
-rw-r--r--xmake/modules/lib/detect/find_toolname.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/xmake/modules/lib/detect/find_toolname.lua b/xmake/modules/lib/detect/find_toolname.lua
index ce3b4f1f1..d997eb879 100644
--- a/xmake/modules/lib/detect/find_toolname.lua
+++ b/xmake/modules/lib/detect/find_toolname.lua
@@ -22,14 +22,14 @@
-- @file find_toolname.lua
--
+-- imports
+import("core.sandbox.module")
+
-- 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
+ if module.find("detect.tools.find_" .. program) then
return program
end
@@ -50,7 +50,7 @@ function _find(program)
-- 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
+ if module.find("detect.tools.find_" .. toolname) then
return toolname
end
@@ -65,7 +65,7 @@ function _find(program)
-- find_toolname.lua exists? found
toolname = name:gsub("%+", "x")
- if os.isfile(path.join(tooldir, "find_" .. toolname .. ".lua")) then
+ if module.find("detect.tools.find_" .. toolname) then
return toolname
end
end