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);
|
let zip_fn = get_file_name(target_path);
|
||||||
zip.start_file(zip_fn, options)?;
|
zip.start_file(zip_fn, options)?;
|
||||||
copy_io_with_head(&mut File::open(target_path)?, &mut zip, -1, "Compressing")?;
|
copy_io_with_head(&mut File::open(target_path)?, &mut zip, -1, "Compressing")?;
|
||||||
|
|
||||||
|
zip.finish()?;
|
||||||
} else {
|
} else {
|
||||||
// TODO dir
|
|
||||||
let mut_zip = RefCell::new(zip);
|
let mut_zip = RefCell::new(zip);
|
||||||
walk_dir(&target_path, &|p, e| {
|
walk_dir(&target_path, &|p, e| {
|
||||||
print_message(MessageType::WARN, &format!("Compress {} failed: {}", &p.display(), &e));
|
print_message(MessageType::WARN, &format!("Compress {} failed: {}", &p.display(), &e));
|
||||||
}, &|f| {
|
}, &|f| {
|
||||||
let options = FileOptions::default().compression_method(CompressionMethod::Stored);
|
let options = FileOptions::default().compression_method(CompressionMethod::Stored);
|
||||||
let mut m_zip = mut_zip.borrow_mut();
|
let mut m_zip = mut_zip.borrow_mut();
|
||||||
match m_zip.start_file("", options) {
|
match m_zip.start_file("", options) { // TODO filename
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(e) => print_message(MessageType::WARN, &format!("Compress {} failed: {}", &f.display(), &e)),
|
Err(e) => print_message(MessageType::WARN, &format!("Compress {} failed: {}", &f.display(), &e)),
|
||||||
};
|
};
|
||||||
// mut_zip.replace(m_zip);
|
|
||||||
}, &|_| { true })?;
|
}, &|_| { true })?;
|
||||||
}
|
|
||||||
|
|
||||||
// TODO finish
|
mut_zip.borrow_mut().finish()?;
|
||||||
// zip.finish()?;
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user