mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
Ask to overwrite dirs when decompressing archives
This commit is contained in:
parent
70c81ed8a4
commit
8ef1b25b12
@ -34,6 +34,13 @@ pub fn unpack_archive(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if file_path.is_dir() {
|
||||||
|
// We can't just use `fs::File::create(&file_path)` because it would return io::ErrorKind::IsADirectory
|
||||||
|
// ToDo: Maybe we should emphasise that `file_path` is a directory and everything inside it will be gone?
|
||||||
|
fs::remove_dir_all(&file_path)?;
|
||||||
|
fs::File::create(&file_path)?;
|
||||||
|
}
|
||||||
|
|
||||||
file.unpack_in(output_folder)?;
|
file.unpack_in(output_folder)?;
|
||||||
|
|
||||||
info!("{:?} extracted. ({})", output_folder.join(file.path()?), Bytes::new(file.size()));
|
info!("{:?} extracted. ({})", output_folder.join(file.path()?), Bytes::new(file.size()));
|
||||||
|
@ -41,6 +41,13 @@ where
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if file_path.is_dir() {
|
||||||
|
// We can't just use `fs::File::create(&file_path)` because it would return io::ErrorKind::IsADirectory
|
||||||
|
// ToDo: Maybe we should emphasise that `file_path` is a directory and everything inside it will be gone?
|
||||||
|
fs::remove_dir_all(&file_path)?;
|
||||||
|
fs::File::create(&file_path)?;
|
||||||
|
}
|
||||||
|
|
||||||
check_for_comments(&file);
|
check_for_comments(&file);
|
||||||
|
|
||||||
match (&*file.name()).ends_with('/') {
|
match (&*file.name()).ends_with('/') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user