libpolymesh/read/unpack.rs
1use std::fs::{
2 File,
3 create_dir_all
4};
5use flate2::read::GzDecoder;
6use tar::Archive;
7
8pub fn unpack_pmf(pmf_file: &str, output_dir: &str) -> Result<(), std::io::Error> {
9
10 // Set up the output directory
11 create_dir_all(output_dir).unwrap();
12
13 // Unpack the pmf file
14 let archive = File::open(pmf_file).unwrap();
15 let decoder = GzDecoder::new(archive);
16 let mut decoder = Archive::new(decoder);
17 decoder.unpack(output_dir).unwrap();
18
19 Ok(())
20
21}