mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge pull request #5454 from cakebaker/mv_rename_vars
mv: rename canonized_* -> canonicalized_*
This commit is contained in:
commit
e1cc796569
1 changed files with 5 additions and 5 deletions
|
@ -3,7 +3,7 @@
|
||||||
// For the full copyright and license information, please view the LICENSE
|
// For the full copyright and license information, please view the LICENSE
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
|
|
||||||
// spell-checker:ignore (ToDO) sourcepath targetpath nushell
|
// spell-checker:ignore (ToDO) sourcepath targetpath nushell canonicalized
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) ->
|
||||||
return Err(MvError::NotADirectory(target_dir.quote().to_string()).into());
|
return Err(MvError::NotADirectory(target_dir.quote().to_string()).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let canonized_target_dir = target_dir
|
let canonicalized_target_dir = target_dir
|
||||||
.canonicalize()
|
.canonicalize()
|
||||||
.unwrap_or_else(|_| target_dir.to_path_buf());
|
.unwrap_or_else(|_| target_dir.to_path_buf());
|
||||||
|
|
||||||
|
@ -440,8 +440,8 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) ->
|
||||||
|
|
||||||
// Check if we have mv dir1 dir2 dir2
|
// Check if we have mv dir1 dir2 dir2
|
||||||
// And generate an error if this is the case
|
// And generate an error if this is the case
|
||||||
if let Ok(canonized_source) = sourcepath.canonicalize() {
|
if let Ok(canonicalized_source) = sourcepath.canonicalize() {
|
||||||
if canonized_source == canonized_target_dir {
|
if canonicalized_source == canonicalized_target_dir {
|
||||||
// User tried to move directory to itself, warning is shown
|
// User tried to move directory to itself, warning is shown
|
||||||
// and process of moving files is continued.
|
// and process of moving files is continued.
|
||||||
show!(USimpleError::new(
|
show!(USimpleError::new(
|
||||||
|
@ -450,7 +450,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) ->
|
||||||
"cannot move '{}' to a subdirectory of itself, '{}/{}'",
|
"cannot move '{}' to a subdirectory of itself, '{}/{}'",
|
||||||
sourcepath.display(),
|
sourcepath.display(),
|
||||||
target_dir.display(),
|
target_dir.display(),
|
||||||
canonized_target_dir.components().last().map_or_else(
|
canonicalized_target_dir.components().last().map_or_else(
|
||||||
|| target_dir.display().to_string(),
|
|| target_dir.display().to_string(),
|
||||||
|dir| { PathBuf::from(dir.as_os_str()).display().to_string() }
|
|dir| { PathBuf::from(dir.as_os_str()).display().to_string() }
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue