added zip support, pkg-fmt override

swapped CI to build zips for windows
This commit is contained in:
ryan 2021-04-08 18:39:54 +12:00
parent 94ad0db41d
commit 1c25b1346f
7 changed files with 160 additions and 24 deletions

View file

@ -7,7 +7,7 @@ use cargo_toml::{Manifest};
use flate2::read::GzDecoder;
use tar::Archive;
use xz2::read::XzDecoder;
use zip::read::ZipArchive;
use crate::{Meta};
@ -77,6 +77,15 @@ pub fn extract<S: AsRef<Path>, P: AsRef<Path>>(source: S, fmt: PkgFmt, path: P)
txz.unpack(path)?;
},
PkgFmt::Zip => {
// Extract to install dir
debug!("Decompressing from archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
let dat = std::fs::File::open(source)?;
let mut zip = ZipArchive::new(dat)?;
zip.extract(path)?;
},
PkgFmt::Bin => {
debug!("Copying data from archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
// Copy to install dir