Skip to content

Commit 2be67f3

Browse files
committed
use tar to extract .tar.gz
1 parent 87630c8 commit 2be67f3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

xmake/modules/utils/archive/extract.lua

+5-3
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ end
3939
-- extract archivefile using tar
4040
function _extract_using_tar(archivefile, outputdir, extension, opt)
4141

42-
-- the tar of windows can only extract "*.tar"
43-
if os.host() == "windows" and extension ~= ".tar" then
42+
-- the tar on windows can only extract "*.tar", "*.tar.gz"
43+
-- the tar on msys2 can extract more, like "*.tar.bz2", ..
44+
if os.host() == "windows" and (extension ~= ".tar" or extension == ".tar.gz") then
4445
return false
4546
end
4647

@@ -425,7 +426,8 @@ function main(archivefile, outputdir, opt)
425426
, [".tgz"] = {_extract_using_7z, _extract_using_tar}
426427
, [".bz2"] = {_extract_using_7z, _extract_using_bzip2}
427428
, [".tar"] = {_extract_using_7z, _extract_using_tar}
428-
, [".tar.gz"] = {_extract_using_7z, _extract_using_gzip}
429+
-- @see https://github.com/xmake-io/xmake/issues/5538
430+
, [".tar.gz"] = {_extract_using_tar, _extract_using_7z, _extract_using_gzip}
429431
, [".tar.xz"] = {_extract_using_7z, _extract_using_xz}
430432
, [".tar.bz2"] = {_extract_using_7z, _extract_using_bzip2}
431433
, [".tar.lz"] = {_extract_using_7z}

0 commit comments

Comments
 (0)