ok ?
This commit is contained in:
@@ -43,24 +43,23 @@ pub fn zip_file(target: &str, zip_file: &str) -> XResult<()> {
|
||||
let zip_fn = get_file_name(target_path);
|
||||
zip.start_file(zip_fn, options)?;
|
||||
copy_io_with_head(&mut File::open(target_path)?, &mut zip, -1, "Compressing")?;
|
||||
|
||||
zip.finish()?;
|
||||
} else {
|
||||
// TODO dir
|
||||
let mut_zip = RefCell::new(zip);
|
||||
walk_dir(&target_path, &|p, e| {
|
||||
print_message(MessageType::WARN, &format!("Compress {} failed: {}", &p.display(), &e));
|
||||
}, &|f| {
|
||||
let options = FileOptions::default().compression_method(CompressionMethod::Stored);
|
||||
let mut m_zip = mut_zip.borrow_mut();
|
||||
match m_zip.start_file("", options) {
|
||||
match m_zip.start_file("", options) { // TODO filename
|
||||
Ok(_) => (),
|
||||
Err(e) => print_message(MessageType::WARN, &format!("Compress {} failed: {}", &f.display(), &e)),
|
||||
};
|
||||
// mut_zip.replace(m_zip);
|
||||
}, &|_| { true })?;
|
||||
}
|
||||
|
||||
// TODO finish
|
||||
// zip.finish()?;
|
||||
mut_zip.borrow_mut().finish()?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user