mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +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 fs_err as fs;
|
||||||
use tar;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
error::FinalError,
|
error::FinalError,
|
||||||
@ -40,7 +39,12 @@ pub fn unpack_archive(
|
|||||||
// spoken text for users using screen readers, braille displays
|
// spoken text for users using screen readers, braille displays
|
||||||
// and so on
|
// 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);
|
files_unpacked.push(file_path);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,12 @@ where
|
|||||||
let file_path = strip_cur_dir(file_path.as_path());
|
let file_path = strip_cur_dir(file_path.as_path());
|
||||||
|
|
||||||
// same reason is in _is_dir: long, often not needed text
|
// 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)?;
|
let mut output_file = fs::File::create(file_path)?;
|
||||||
io::copy(&mut file, &mut output_file)?;
|
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 => {
|
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => {
|
||||||
if user_wants_to_overwrite(path, question_policy)? {
|
if user_wants_to_overwrite(path, question_policy)? {
|
||||||
if path.is_dir() {
|
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)?;
|
fs::remove_dir_all(path)?;
|
||||||
}
|
}
|
||||||
Ok(Some(fs::File::create(path)?))
|
Ok(Some(fs::File::create(path)?))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user