/// Extracts the zips from Wix and VC_REDIST into a useable path.
Extracts the zips from Wix and VC_REDIST into a useable path.
Extracts the zips from Wix and VC_REDIST into a useable path .
fn extract_zip(data: &[u8], path: &Path) -> crate::Result<()> {
  let cursor = Cursor::new(data);
  let mut zipa = ZipArchive::new(cursor)?;
  for i in 0..zipa.len() {
    let mut file = zipa.by_index(i)?;
    let dest_path = path.join(file.name());
    let parent = dest_path.parent().expect("Failed to get parent");
    if !parent.exists() {
      create_dir_all(parent)?;
    }
    let mut buff: Vec<u8> = Vec::new();
    file.read_to_end(&mut buff)?;
    let mut fileout = File::create(dest_path).expect("Failed to open file");
    fileout.write_all(&buff)?;
  }
  Ok(())
}
fn extract_zip ( data : & [ u8 ] , path : & Path ) -> crate :: Result < ( ) > { let cursor = Cursor :: new ( data ) ; let mut zipa = ZipArchive :: new ( cursor ) ? ; for i in 0 .. zipa . len ( ) { let mut file = zipa . by_index ( i ) ? ; let dest_path = path . join ( file . name ( ) ) ; let parent = dest_path . parent ( ) . expect ( " " ) ; if ! parent . exists ( ) { create_dir_all ( parent ) ? ; } let mut buff : Vec < u8 > = Vec :: new ( ) ; file . read_to_end ( & mut buff ) ? ; let mut fileout = File :: create ( dest_path ) . expect ( " " ) ; fileout . write_all ( & buff ) ? ; } Ok ( ( ) ) }
Extracts the zips from Wix and VC_REDIST into a useable path.
Extracts the zips from Wix and VC_REDIST into a useable path .
data
&[u8]
path
&Path