2023-01-14 15:35:50 +00:00
|
|
|
fn main() -> Result<(), unpak::Error> {
|
|
|
|
let mut pak = unpak::Pak::new(
|
2023-01-14 14:20:00 +00:00
|
|
|
std::io::BufReader::new(std::io::Cursor::new(include_bytes!("rando_p.pak"))),
|
2023-01-14 15:35:50 +00:00
|
|
|
unpak::Version::CompressionEncryption,
|
2023-01-14 14:20:00 +00:00
|
|
|
None,
|
|
|
|
)?;
|
|
|
|
for file in pak.files() {
|
2023-01-14 14:41:57 +00:00
|
|
|
std::fs::create_dir_all(
|
|
|
|
std::path::Path::new(&file)
|
|
|
|
.parent()
|
|
|
|
.expect("will be a file"),
|
|
|
|
)?;
|
2023-01-14 14:20:00 +00:00
|
|
|
match pak.get(&file).expect("file should be in pak") {
|
|
|
|
Ok(data) => std::fs::write(&file, data)?,
|
|
|
|
Err(e) => eprintln!("{e}"),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|