1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 12:37:49 +00:00

Various fixes

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
This commit is contained in:
Sylvestre Ledru 2024-01-05 10:11:35 +01:00
parent aabf5fa577
commit e64a0b4a26
3 changed files with 3 additions and 4 deletions

View file

@ -172,7 +172,7 @@ impl Entry {
let mut descendant =
get_local_to_root_parent(&source_absolute, context.root_parent.as_deref())?;
if no_target_dir {
let source_is_dir: bool = direntry.path().is_dir();
let source_is_dir = direntry.path().is_dir();
if path_ends_with_terminator(context.target) && source_is_dir {
if let Err(e) = std::fs::create_dir_all(context.target) {
eprintln!("Failed to create directory: {}", e);

View file

@ -318,8 +318,8 @@ fn handle_two_paths(source: &Path, target: &Path, opts: &Options) -> UResult<()>
}
}
let target_is_dir: bool = target.is_dir();
let source_is_dir: bool = source.is_dir();
let target_is_dir = target.is_dir();
let source_is_dir = source.is_dir();
if path_ends_with_terminator(target)
&& (!target_is_dir && !source_is_dir)

View file

@ -724,7 +724,6 @@ pub fn are_hardlinks_or_one_way_symlink_to_same_file(source: &Path, target: &Pat
///
/// * `path` - A reference to the path to be checked.
#[cfg(unix)]
pub fn path_ends_with_terminator(path: &Path) -> bool {
use std::os::unix::prelude::OsStrExt;
path.as_os_str()