Skip to content

Commit

Permalink
Various fixes
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Hofstetter <[email protected]>
  • Loading branch information
sylvestre and cakebaker committed Jan 5, 2024
1 parent aabf5fa commit e64a0b4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/uu/cp/src/copydir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/uu/mv/src/mv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/uucore/src/lib/features/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e64a0b4

Please sign in to comment.