mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 03:55:28 +00:00
minor tweaks
This commit is contained in:
parent
71893aafeb
commit
a2c91c4248
@ -9,7 +9,6 @@ use std::{
|
||||
};
|
||||
|
||||
use fs_err as fs;
|
||||
use tar;
|
||||
|
||||
use crate::{
|
||||
error::FinalError,
|
||||
@ -40,7 +39,12 @@ pub fn unpack_archive(
|
||||
// spoken text for users using screen readers, braille displays
|
||||
// and so on
|
||||
|
||||
info!(@display_handle, inaccessible, "{:?} extracted. ({})", utils::strip_cur_dir(&output_folder.join(file.path()?)), Bytes::new(file.size()));
|
||||
info!(
|
||||
@display_handle,
|
||||
inaccessible,
|
||||
"{:?} extracted. ({})",
|
||||
utils::strip_cur_dir(&output_folder.join(file.path()?)), Bytes::new(file.size())
|
||||
);
|
||||
|
||||
files_unpacked.push(file_path);
|
||||
}
|
||||
|
@ -68,7 +68,12 @@ where
|
||||
let file_path = strip_cur_dir(file_path.as_path());
|
||||
|
||||
// same reason is in _is_dir: long, often not needed text
|
||||
info!(@display_handle, inaccessible, "{:?} extracted. ({})", file_path.display(), Bytes::new(file.size()));
|
||||
info!(
|
||||
@display_handle,
|
||||
inaccessible,
|
||||
"{:?} extracted. ({})",
|
||||
file_path.display(), Bytes::new(file.size())
|
||||
);
|
||||
|
||||
let mut output_file = fs::File::create(file_path)?;
|
||||
io::copy(&mut file, &mut output_file)?;
|
||||
|
@ -60,8 +60,6 @@ pub fn create_or_ask_overwrite(path: &Path, question_policy: QuestionPolicy) ->
|
||||
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => {
|
||||
if user_wants_to_overwrite(path, question_policy)? {
|
||||
if path.is_dir() {
|
||||
// We can't just use `fs::File::create(&path)` because it would return io::ErrorKind::IsADirectory
|
||||
// ToDo: Maybe we should emphasise that `path` is a directory and everything inside it will be gone?
|
||||
fs::remove_dir_all(path)?;
|
||||
}
|
||||
Ok(Some(fs::File::create(path)?))
|
||||
|
Loading…
x
Reference in New Issue
Block a user