don't assume tar supports -a flag

This commit is contained in:
nakst 2022-01-28 09:53:57 +00:00
parent b6e8b8f17f
commit 4ac89712e6
1 changed files with 14 additions and 1 deletions

View File

@ -52,7 +52,20 @@ void Get(str url, str directoryName, str checksum) {
PrintStdErr("Valid checksum.\n");
}
assert SystemShellExecute("tar -xaf %cachePath%");
str decompressFlag = "";
if StringContains(url, ".tar.bz2") {
decompressFlag = "j";
} else if StringContains(url, ".tar.xz") {
decompressFlag = "J";
} else if StringContains(url, ".tar.gz") {
decompressFlag = "z";
} else {
PrintStdErrWarning("Error: Unrecognised archive format extension.\n");
assert false;
}
assert SystemShellExecute("tar -x%decompressFlag%f %cachePath%");
assert PathMove(directoryName, "bin/source");
PrintStdErr("File successfully downloaded and extracted.\n");