From ab8048f449cf267cadcd79ba1862985cdebaf3b7 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 17 Jun 2017 23:53:44 +0800 Subject: fix find tool bug for old script --- xmake/core/tool/tool.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua index 7b139b12b..6db2e4439 100644 --- a/xmake/core/tool/tool.lua +++ b/xmake/core/tool/tool.lua @@ -84,10 +84,13 @@ function tool._find(root, name) name = names[#names] end - -- get the last name by '-': xxx-xxx-toolname - local names = name:split("%-") - if #names > 0 then - name = names[#names] + -- get the last valid name: xxx-xxx-toolname-5 + local partnames = {} + for partname in name:gmatch("([%a%+]+)") do + table.insert(partnames, partname) + end + if #partnames > 0 then + name = partnames[#partnames] end -- remove suffix: ".xxx" -- cgit v1.3.1