diff options
| author | ruki <[email protected]> | 2024-10-08 22:59:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-10-08 22:59:02 +0800 |
| commit | 124e091f949eb35a47129086f8320eb8ae5bfcbd (patch) | |
| tree | 38dbf00dbe4eacd809d38edda5801ca2f1b74575 | |
| parent | 669596b986f75a9e10796538710ba510dadb8d05 (diff) | |
improve is_config #5690
| -rw-r--r-- | xmake/core/project/config.lua | 14 |
1 files 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 |
