diff options
| author | ruki <[email protected]> | 2022-09-22 23:32:10 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-09-22 23:32:10 +0800 |
| commit | c1b7687cf86b5af65cbc7bff51979e8868d31f74 (patch) | |
| tree | fd6dc083f2c5d93fc5e6df9c39b61906d7bc5746 | |
| parent | 9473e491160500cda2670e5140cfd2bfe2c1adbb (diff) | |
improve tool #2853
| -rw-r--r-- | xmake/core/project/target.lua | 9 | ||||
| -rw-r--r-- | xmake/core/tool/tool.lua | 9 | ||||
| -rw-r--r-- | xmake/core/tool/toolchain.lua | 9 |
3 files changed, 21 insertions, 6 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 755535706..329eb53e3 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -2082,8 +2082,13 @@ function _instance:tool(toolkind) if program and not toolname then local pos = program:find('@', 1, true) if pos then - toolname = program:sub(1, pos - 1) - program = program:sub(pos + 1) + -- we need ignore valid path with `@`, e.g. /usr/local/opt/[email protected]/bin/go + -- https://github.com/xmake-io/xmake/issues/2853 + local prefix = program:sub(1, pos - 1) + if prefix and not prefix:find("[/\\]") then + toolname = prefix + program = program:sub(pos + 1) + end end end diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua index af62c7f8e..5d8672141 100644 --- a/xmake/core/tool/tool.lua +++ b/xmake/core/tool/tool.lua @@ -186,8 +186,13 @@ function tool.load(kind, opt) if program then local pos = program:find('@', 1, true) if pos then - toolname = program:sub(1, pos - 1) - program = program:sub(pos + 1) + -- we need ignore valid path with `@`, e.g. /usr/local/opt/[email protected]/bin/go + -- https://github.com/xmake-io/xmake/issues/2853 + local prefix = program:sub(1, pos - 1) + if prefix and not prefix:find("[/\\]") then + toolname = prefix + program = program:sub(pos + 1) + end end end diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua index 94a9309e9..32507768a 100644 --- a/xmake/core/tool/toolchain.lua +++ b/xmake/core/tool/toolchain.lua @@ -721,8 +721,13 @@ function toolchain.tool(toolchains, toolkind, opt) if program and type(program) == "string" then local pos = program:find('@', 1, true) if pos then - toolname = program:sub(1, pos - 1) - program = program:sub(pos + 1) + -- we need ignore valid path with `@`, e.g. /usr/local/opt/[email protected]/bin/go + -- https://github.com/xmake-io/xmake/issues/2853 + local prefix = program:sub(1, pos - 1) + if prefix and not prefix:find("[/\\]") then + toolname = prefix + program = program:sub(pos + 1) + end updatecache = true end end |
