update io::unzip
This commit is contained in:
parent
00c3740af0
commit
9dc569e646
10
src/io.rs
10
src/io.rs
@ -1,11 +1,13 @@
|
|||||||
pub fn unzip(zip_path: &str, out_path: &str) {
|
use std::{fs, path::Path};
|
||||||
let mut archive = zip::ZipArchive::new(fs::File::open(&temp_file).unwrap()).unwrap();
|
|
||||||
|
pub fn unzip(zip_path: &Path, out_path: &Path) {
|
||||||
|
let mut archive = zip::ZipArchive::new(fs::File::open(zip_path).unwrap()).unwrap();
|
||||||
for i in 0..archive.len() {
|
for i in 0..archive.len() {
|
||||||
let mut file = archive.by_index(i).unwrap();
|
let mut file = archive.by_index(i).unwrap();
|
||||||
let outpath = iw4x_path.join(file.name());
|
let outpath = out_path.join(file.name());
|
||||||
|
|
||||||
if (*file.name()).ends_with('/') {
|
if (*file.name()).ends_with('/') {
|
||||||
fs::create_dir_all(&outpath).unwrap();
|
fs::create_dir_all(outpath).unwrap();
|
||||||
} else {
|
} else {
|
||||||
println!("Unpacking {}", file.name());
|
println!("Unpacking {}", file.name());
|
||||||
if let Some(p) = outpath.parent() {
|
if let Some(p) = outpath.parent() {
|
||||||
|
Loading…
Reference in New Issue
Block a user