mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 20:15:27 +00:00
Merge pull request #230 from sigmaSd/zipid
Mark directories when compressing to zip regardless of their contents
This commit is contained in:
commit
7a358ef821
@ -14,10 +14,7 @@ use crate::{
|
|||||||
error::FinalError,
|
error::FinalError,
|
||||||
info,
|
info,
|
||||||
list::FileInArchive,
|
list::FileInArchive,
|
||||||
utils::{
|
utils::{self, cd_into_same_dir_as, concatenate_os_str_list, get_invalid_utf8_paths, strip_cur_dir, to_utf, Bytes},
|
||||||
self, cd_into_same_dir_as, concatenate_os_str_list, dir_is_empty, get_invalid_utf8_paths, strip_cur_dir,
|
|
||||||
to_utf, Bytes,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Unpacks the archive given by `archive` into the folder given by `output_folder`.
|
/// Unpacks the archive given by `archive` into the folder given by `output_folder`.
|
||||||
@ -136,10 +133,7 @@ where
|
|||||||
info!(@display_handle, inaccessible, "Compressing '{}'.", to_utf(path));
|
info!(@display_handle, inaccessible, "Compressing '{}'.", to_utf(path));
|
||||||
|
|
||||||
if path.is_dir() {
|
if path.is_dir() {
|
||||||
if dir_is_empty(path) {
|
|
||||||
writer.add_directory(path.to_str().unwrap().to_owned(), options)?;
|
writer.add_directory(path.to_str().unwrap().to_owned(), options)?;
|
||||||
}
|
|
||||||
// If a dir has files, the files are responsible for creating them.
|
|
||||||
} else {
|
} else {
|
||||||
writer.start_file(path.to_str().unwrap().to_owned(), options)?;
|
writer.start_file(path.to_str().unwrap().to_owned(), options)?;
|
||||||
let file_bytes = match fs::read(entry.path()) {
|
let file_bytes = match fs::read(entry.path()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user