Skip to content

Commit

Permalink
improve is_config #5690
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Oct 8, 2024
1 parent 669596b commit 124e091
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions xmake/core/project/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -280,18 +280,19 @@ end

-- the current config is belong to the given config values?
function config.is_value(name, ...)

-- get the current config value
local value = config.get(name)
if not value then return false end
if value == nil then
return false
end

-- exists this value? and escape '-'
value = tostring(value)
for _, v in ipairs(table.pack(...)) do
if v and type(v) == "string" and value:find("^" .. v:gsub("%-", "%%-") .. "$") then
-- escape '-'
v = tostring(v)
if value == v or value:find("^" .. v:gsub("%-", "%%-") .. "$") then
return true
end
end

return false
end

Expand All @@ -302,7 +303,6 @@ function config.has(...)
return true
end
end

return false
end

Expand Down

0 comments on commit 124e091

Please sign in to comment.