mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-08 20:45:29 +00:00
always use zip64
This commit is contained in:
parent
634978fea5
commit
58da7dbf34
@ -145,7 +145,9 @@ where
|
|||||||
W: Write + Seek,
|
W: Write + Seek,
|
||||||
{
|
{
|
||||||
let mut writer = zip::ZipWriter::new(writer);
|
let mut writer = zip::ZipWriter::new(writer);
|
||||||
let options = zip::write::FileOptions::default();
|
// always use ZIP64 to allow compression of files larger than 4GB
|
||||||
|
// the format is widely supported and the extra 20B is negligible in most cases
|
||||||
|
let options = zip::write::FileOptions::default().large_file(true);
|
||||||
let output_handle = Handle::from_path(output_path);
|
let output_handle = Handle::from_path(output_path);
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
@ -220,15 +222,9 @@ where
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut file = fs::File::open(path)?;
|
let mut file = fs::File::open(path)?;
|
||||||
let large = file.metadata().map_or(
|
|
||||||
true,
|
|
||||||
|metadata| metadata.len() > 0xffffffff, // 4 GB
|
|
||||||
);
|
|
||||||
writer.start_file(
|
writer.start_file(
|
||||||
path.to_str().unwrap(),
|
path.to_str().unwrap(),
|
||||||
options
|
options.last_modified_time(get_last_modified_time(&file)),
|
||||||
.large_file(large)
|
|
||||||
.last_modified_time(get_last_modified_time(&file)),
|
|
||||||
)?;
|
)?;
|
||||||
io::copy(&mut file, &mut writer)?;
|
io::copy(&mut file, &mut writer)?;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user