mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-15 08:34:43 +01:00
get zip data from zip path
This commit is contained in:
@@ -24,30 +24,11 @@ pub fn unzip(zipfile: &str, zippath: &str, destpath: &str) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Iterate zip files
|
let zipData = match zip.by_name(zippath) {
|
||||||
for i in 0..zip.len()
|
Ok(zipData) => zipData,
|
||||||
{
|
Err(e) => {
|
||||||
// Get file
|
println!("Could not find zip file: {}", e);
|
||||||
let mut file = match zip.by_index(i) {
|
return;
|
||||||
Ok(file) => file,
|
}
|
||||||
Err(e) => {
|
};
|
||||||
println!("Could not open zip file: {}", e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
println!("Filename: {}", file.name());
|
|
||||||
|
|
||||||
// Read the first byte if it is a file
|
|
||||||
let first_byte = match file.bytes().next() {
|
|
||||||
Some(b) => b,
|
|
||||||
None => {
|
|
||||||
println!("Could not read first byte of file");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Output first byte
|
|
||||||
println!("{:?}", first_byte);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user