From 124e091f949eb35a47129086f8320eb8ae5bfcbd Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 8 Oct 2024 22:59:02 +0800 Subject: improve is_config #5690 --- xmake/core/project/config.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua index 0eb005bf6..650bbc4a6 100644 --- a/xmake/core/project/config.lua +++ b/xmake/core/project/config.lua @@ -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 @@ -302,7 +303,6 @@ function config.has(...) return true end end - return false end -- cgit v1.3.1