From 26c6499f97244bc6c663777b2f765bf594a290d5 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 13 Aug 2021 14:30:35 +0800 Subject: Update extract.lua --- xmake/modules/utils/archive/extract.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua index 2c0b8fb8d..f8f348bcb 100644 --- a/xmake/modules/utils/archive/extract.lua +++ b/xmake/modules/utils/archive/extract.lua @@ -44,7 +44,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt) end -- on msys2/cygwin? we need translate input path to cygwin-like path - if is_subhost("msys", "cygwin") and program:gsub("\\", "/"):find("/usr/bin") then + if is_subhost("msys", "cygwin") then archivefile = path.cygwin_path(archivefile) end @@ -98,6 +98,12 @@ function _extract_using_7z(archivefile, outputdir, extension, opt) return false end + -- p7zip cannot extract other archive format on msys/cygwin + -- https://github.com/xmake-io/xmake/issues/1575#issuecomment-898205462 + if is_subhost("msys", "cygwin") and extension ~= ".7z" and program:startswith("sh ") then + return false + end + -- extract to *.tar file first local outputdir_old = nil if extension:startswith(".tar.") or extension == ".tgz" then @@ -389,11 +395,15 @@ end -- extract archive file using extractors function _extract(archivefile, outputdir, extension, extractors, opt) + + -- extract it for _, extract in ipairs(extractors) do if extract(archivefile, outputdir, extension, opt) then return true end end + + -- failed return false end -- cgit v1.3.1