Skip to content

Commit

Permalink
Merge pull request #230 from sigmaSd/zipid
Browse files Browse the repository at this point in the history
Mark directories when compressing to zip regardless of their contents
  • Loading branch information
marcospb19 committed Dec 20, 2021
2 parents 793a229 + 40bb56b commit 7a358ef
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/archive/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ use crate::{
error::FinalError,
info,
list::FileInArchive,
utils::{
self, cd_into_same_dir_as, concatenate_os_str_list, dir_is_empty, get_invalid_utf8_paths, strip_cur_dir,
to_utf, Bytes,
},
utils::{self, cd_into_same_dir_as, concatenate_os_str_list, get_invalid_utf8_paths, strip_cur_dir, to_utf, Bytes},
};

/// Unpacks the archive given by `archive` into the folder given by `output_folder`.
Expand Down Expand Up @@ -136,10 +133,7 @@ where
info!(@display_handle, inaccessible, "Compressing '{}'.", to_utf(path));

if path.is_dir() {
if dir_is_empty(path) {
writer.add_directory(path.to_str().unwrap().to_owned(), options)?;
}
// If a dir has files, the files are responsible for creating them.
writer.add_directory(path.to_str().unwrap().to_owned(), options)?;
} else {
writer.start_file(path.to_str().unwrap().to_owned(), options)?;
let file_bytes = match fs::read(entry.path()) {
Expand Down

0 comments on commit 7a358ef

Please sign in to comment.