39
39
-- extract archivefile using tar
40
40
function _extract_using_tar (archivefile , outputdir , extension , opt )
41
41
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" and extension ~= " .tar.gz" ) then
44
45
return false
45
46
end
46
47
@@ -69,7 +70,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt)
69
70
end
70
71
end
71
72
table.insert (argv , " -xf" )
72
- table.insert (argv , archivefile )
73
+ table.insert (argv , path . absolute ( archivefile ) )
73
74
74
75
-- ensure output directory
75
76
if not os .isdir (outputdir ) then
@@ -96,6 +97,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt)
96
97
else
97
98
os .vrunv (program , argv )
98
99
end
100
+
99
101
return true
100
102
end
101
103
@@ -425,7 +427,8 @@ function main(archivefile, outputdir, opt)
425
427
, [" .tgz" ] = {_extract_using_7z , _extract_using_tar }
426
428
, [" .bz2" ] = {_extract_using_7z , _extract_using_bzip2 }
427
429
, [" .tar" ] = {_extract_using_7z , _extract_using_tar }
428
- , [" .tar.gz" ] = {_extract_using_7z , _extract_using_gzip }
430
+ -- @see https://github.com/xmake-io/xmake/issues/5538
431
+ , [" .tar.gz" ] = {_extract_using_tar , _extract_using_7z , _extract_using_gzip }
429
432
, [" .tar.xz" ] = {_extract_using_7z , _extract_using_xz }
430
433
, [" .tar.bz2" ] = {_extract_using_7z , _extract_using_bzip2 }
431
434
, [" .tar.lz" ] = {_extract_using_7z }
@@ -458,3 +461,4 @@ function main(archivefile, outputdir, opt)
458
461
-- extract it
459
462
return _extract (archivefile , outputdir , extension , extractors [extension ], opt )
460
463
end
464
+
0 commit comments