summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-12-22 20:16:45 +0800
committerGitHub <[email protected]>2022-12-22 20:16:45 +0800
commit8a4280dea19348235d33c1d469e738570a961fdd (patch)
tree37ee68e3adb5283b8bec59205b0f095cd0395dd5
parent72cd4e4453aa35c1e10d23160d52f5e1eb478b46 (diff)
parent99e9ce23871314c8d5ac24d588950cfcfa6f11ac (diff)
Merge pull request #3191 from SirLynix/patch-13
Fix .zip decompression when unzip is not installed
-rw-r--r--xmake/modules/utils/archive/extract.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua
index f8098d834..8a6fbcd02 100644
--- a/xmake/modules/utils/archive/extract.lua
+++ b/xmake/modules/utils/archive/extract.lua
@@ -371,7 +371,8 @@ end
-- extract archive file using extractors
function _extract(archivefile, outputdir, extension, extractors, opt)
for _, extract in ipairs(extractors) do
- if extract(archivefile, outputdir, extension, opt) then
+ local ok = try {function () return extract(archivefile, outputdir, extension, opt) end}
+ if ok then
return true
end
end
@@ -414,7 +415,8 @@ function main(archivefile, outputdir, opt)
else
extractors =
{
- [".zip"] = {_extract_using_unzip, _extract_using_tar, _extract_using_7z}
+ -- tar supports .zip on macOS but does not on Linux
+ [".zip"] = is_host("macosx") and {_extract_using_unzip, _extract_using_tar, _extract_using_7z} or {_extract_using_unzip, _extract_using_7z}
, [".7z"] = {_extract_using_7z}
, [".gz"] = {_extract_using_gzip, _extract_using_tar, _extract_using_7z}
, [".xz"] = {_extract_using_xz, _extract_using_tar, _extract_using_7z}