Skip to content

Commit ed50eae

Browse files
committed
improve tar
1 parent 2be67f3 commit ed50eae

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

xmake/modules/utils/archive/extract.lua

+9-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt)
4141

4242
-- the tar on windows can only extract "*.tar", "*.tar.gz"
4343
-- the tar on msys2 can extract more, like "*.tar.bz2", ..
44-
if os.host() == "windows" and (extension ~= ".tar" or extension == ".tar.gz") then
44+
if os.host() == "windows" and (extension ~= ".tar" and extension ~= ".tar.gz") then
4545
return false
4646
end
4747

@@ -69,8 +69,12 @@ function _extract_using_tar(archivefile, outputdir, extension, opt)
6969
table.insert(argv, "--force-local")
7070
end
7171
end
72-
table.insert(argv, "-xf")
73-
table.insert(argv, archivefile)
72+
if option.get("verbose") then
73+
table.insert(argv, "-xvf")
74+
else
75+
table.insert(argv, "-xf")
76+
end
77+
table.insert(argv, path.absolute(archivefile))
7478

7579
-- ensure output directory
7680
if not os.isdir(outputdir) then
@@ -97,6 +101,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt)
97101
else
98102
os.vrunv(program, argv)
99103
end
104+
100105
return true
101106
end
102107

@@ -460,3 +465,4 @@ function main(archivefile, outputdir, opt)
460465
-- extract it
461466
return _extract(archivefile, outputdir, extension, extractors[extension], opt)
462467
end
468+

0 commit comments

Comments
 (0)