diff options
| author | ruki <[email protected]> | 2024-02-21 22:43:12 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-02-21 22:43:12 +0800 |
| commit | 9f188d9dad5c88ffa0af6c096ad8eb79312a7e00 (patch) | |
| tree | 47de12efd026b9af2a1cf7d239d23fa9922f3640 | |
| parent | 767c7ff1f7a8690d0577158afd10772a22437aa0 (diff) | |
improve match_script
| -rw-r--r-- | xmake/core/base/private/select_script.lua | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/xmake/core/base/private/select_script.lua b/xmake/core/base/private/select_script.lua index b1039d061..1fe8a77fd 100644 --- a/xmake/core/base/private/select_script.lua +++ b/xmake/core/base/private/select_script.lua @@ -87,20 +87,29 @@ end -- `!linux|*` -- function _match_script(pattern, plat, arch, excluded) - local splitinfo = pattern:split("@", {plain = true}) + local splitinfo = pattern:split("@", {strict = true, plain = true}) local plat_part = splitinfo[1] local host_part = splitinfo[2] - local plat_patterns = plat_part:split(",", {plain = true}) + local plat_patterns + if plat_part and #plat_part > 0 then + plat_patterns = plat_part:split(",", {plain = true}) + end local host_patterns - if host_part then + if host_part and #host_part > 0 then host_patterns = host_part:split(",", {plain = true}) end - if _match_patterns(plat_patterns, plat, arch, excluded) then - if host_patterns and #host_patterns > 0 and - not _match_patterns(host_patterns, os.subhost(), os.subarch(), excluded) then - return false + if plat_patterns and #plat_patterns > 0 then + if _match_patterns(plat_patterns, plat, arch, excluded) then + if host_patterns and #host_patterns > 0 and + not _match_patterns(host_patterns, os.subhost(), os.subarch(), excluded) then + return false + end + return true + end + else + if host_patterns and #host_patterns > 0 then + return _match_patterns(host_patterns, os.subhost(), os.subarch(), excluded) end - return true end end |
