mirror of
https://github.com/ouch-org/ouch.git
synced 2025-07-19 16:10:53 +00:00
Merge a85c12a12fbc7a44252a78f76d02e75216c257c9 into bbce74666682aa26f62fe0cc980b196257f846fb
This commit is contained in:
commit
423db52c57
@ -37,6 +37,7 @@ Categories Used:
|
|||||||
|
|
||||||
- Fix tar extraction count when --quiet [\#824](https://github.com/ouch-org/ouch/pull/824) ([marcospb19](https://github.com/marcospb19))
|
- Fix tar extraction count when --quiet [\#824](https://github.com/ouch-org/ouch/pull/824) ([marcospb19](https://github.com/marcospb19))
|
||||||
- Fix 7z BadSignature error when compressing and then listing [\#819](https://github.com/ouch-org/ouch/pull/819) ([tommady](https://github.com/tommady))
|
- Fix 7z BadSignature error when compressing and then listing [\#819](https://github.com/ouch-org/ouch/pull/819) ([tommady](https://github.com/tommady))
|
||||||
|
- Fix Unpacking with merge flag failed without --dir flag [\#826](https://github.com/ouch-org/ouch/pull/826) ([tommady](https://github.com/tommady))
|
||||||
|
|
||||||
### Tweaks
|
### Tweaks
|
||||||
|
|
||||||
|
@ -413,7 +413,9 @@ fn smart_unpack(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Rename the temporary directory to the archive name, which is output_file_path
|
// Rename the temporary directory to the archive name, which is output_file_path
|
||||||
fs::rename(&previous_path, &new_path)?;
|
if fs::rename(&previous_path, &new_path).is_err() {
|
||||||
|
utils::copy_dir(&previous_path, &new_path)?;
|
||||||
|
};
|
||||||
info_accessible(format!(
|
info_accessible(format!(
|
||||||
"Successfully moved \"{}\" to \"{}\"",
|
"Successfully moved \"{}\" to \"{}\"",
|
||||||
nice_directory_display(&previous_path),
|
nice_directory_display(&previous_path),
|
||||||
|
@ -209,3 +209,23 @@ pub fn try_infer_extension(path: &Path) -> Option<Extension> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Copy the src directory into the dst directory recursively
|
||||||
|
pub fn copy_dir(src: &Path, dst: &Path) -> crate::Result<()> {
|
||||||
|
if !src.exists() || !dst.exists() {
|
||||||
|
return Err(crate::Error::NotFound {
|
||||||
|
error_title: "source or destination directory does not exist".to_string(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for entry in fs::read_dir(src)? {
|
||||||
|
let entry = entry?;
|
||||||
|
let ty = entry.file_type()?;
|
||||||
|
if ty.is_dir() {
|
||||||
|
copy_dir(entry.path().as_path(), dst.join(entry.file_name()).as_path())?;
|
||||||
|
} else {
|
||||||
|
fs::copy(entry.path(), dst.join(entry.file_name()).as_path())?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
@ -18,7 +18,7 @@ pub use self::{
|
|||||||
EscapedPathDisplay,
|
EscapedPathDisplay,
|
||||||
},
|
},
|
||||||
fs::{
|
fs::{
|
||||||
cd_into_same_dir_as, create_dir_if_non_existent, is_path_stdin, remove_file_or_dir,
|
cd_into_same_dir_as, copy_dir, create_dir_if_non_existent, is_path_stdin, remove_file_or_dir,
|
||||||
rename_for_available_filename, resolve_path_conflict, try_infer_extension,
|
rename_for_available_filename, resolve_path_conflict, try_infer_extension,
|
||||||
},
|
},
|
||||||
question::{
|
question::{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user