Refactor: add subdirectory-after-writing-parent option
This commit is contained in:
parent
51ce58751e
commit
c31d85930b
1 changed files with 7 additions and 0 deletions
|
@ -13,6 +13,9 @@ pub enum BasicFileOperation {
|
||||||
options: zip_next::write::FileOptions,
|
options: zip_next::write::FileOptions,
|
||||||
},
|
},
|
||||||
WriteDirectory(zip_next::write::FileOptions),
|
WriteDirectory(zip_next::write::FileOptions),
|
||||||
|
WriteSubdirectory {
|
||||||
|
parent_dir: BasicFileOperation::WriteSubdirectory
|
||||||
|
},
|
||||||
WriteSymlinkWithTarget {
|
WriteSymlinkWithTarget {
|
||||||
target: Box<PathBuf>,
|
target: Box<PathBuf>,
|
||||||
options: zip_next::write::FileOptions,
|
options: zip_next::write::FileOptions,
|
||||||
|
@ -57,6 +60,10 @@ fn do_operation<T>(writer: &mut RefCell<zip_next::ZipWriter<T>>,
|
||||||
BasicFileOperation::WriteDirectory(options) => {
|
BasicFileOperation::WriteDirectory(options) => {
|
||||||
writer.borrow_mut().add_directory(name, options)?;
|
writer.borrow_mut().add_directory(name, options)?;
|
||||||
}
|
}
|
||||||
|
BasicFileOperation::WriteSubdirectory(parent_dir) => {
|
||||||
|
do_operation(writer, parent_dir)?;
|
||||||
|
writer.borrow_mut().add_directory(parent_dir.referenceable_name() + name, options)?;
|
||||||
|
}
|
||||||
BasicFileOperation::WriteSymlinkWithTarget {target, options} => {
|
BasicFileOperation::WriteSymlinkWithTarget {target, options} => {
|
||||||
writer.borrow_mut().add_symlink(name, target.to_string_lossy(), options)?;
|
writer.borrow_mut().add_symlink(name, target.to_string_lossy(), options)?;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue