This PR implements the feature discussed in #12, allowing an instance of FileOptions to be set for each file or directory processed by create_from_directory_with_options(). As mentioned there, this API refactor would be a breaking change.
Current usage of the API:
let mut zip = ZipWriter::new(file);
// This has the limitation of only allowing one configuration for all the files and directories.
zip.create_from_directory_with_options(
&PathBuf::from(&source_dir),
FileOptions::default(),
);
API usage with this PR:
let mut zip = ZipWriter::new(file);
zip.create_from_directory_with_options(&PathBuf::from(&source_dir), |file: &PathBuf| {
if file.eq(&PathBuf::from("dir/my_executable")) {
FileOptions::default().unix_permissions(0o775)
} else {
FileOptions::default()
}
});
This PR implements the feature discussed in #12, allowing an instance of
FileOptions
to be set for each file or directory processed bycreate_from_directory_with_options()
. As mentioned there, this API refactor would be a breaking change.Current usage of the API:
API usage with this PR: