From c31d85930babd1867940b06b6d02a3a1a489dbc5 Mon Sep 17 00:00:00 2001 From: Chris Hennick Date: Sun, 14 May 2023 18:41:49 -0700 Subject: [PATCH] Refactor: add subdirectory-after-writing-parent option --- fuzz/fuzz_targets/fuzz_write.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fuzz/fuzz_targets/fuzz_write.rs b/fuzz/fuzz_targets/fuzz_write.rs index 5df9e50d..ce9f213c 100644 --- a/fuzz/fuzz_targets/fuzz_write.rs +++ b/fuzz/fuzz_targets/fuzz_write.rs @@ -13,6 +13,9 @@ pub enum BasicFileOperation { options: zip_next::write::FileOptions, }, WriteDirectory(zip_next::write::FileOptions), + WriteSubdirectory { + parent_dir: BasicFileOperation::WriteSubdirectory + }, WriteSymlinkWithTarget { target: Box, options: zip_next::write::FileOptions, @@ -57,6 +60,10 @@ fn do_operation(writer: &mut RefCell>, BasicFileOperation::WriteDirectory(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} => { writer.borrow_mut().add_symlink(name, target.to_string_lossy(), options)?; }