Skip to content

Commit

Permalink
uucore/fs: make function more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
niyaznigmatullin committed Jul 19, 2022
1 parent b76c53c commit 9f2a9fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/uu/realpath/src/realpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,12 @@ fn process_relative(
) -> PathBuf {
if let Some(base) = relative_base {
if path.starts_with(base) {
make_path_relative_to(path.as_path(), relative_to.unwrap_or(base))
make_path_relative_to(path, relative_to.unwrap_or(base))
} else {
path
}
} else if let Some(to) = relative_to {
make_path_relative_to(path.as_path(), to)
make_path_relative_to(path, to)
} else {
path
}
Expand Down
2 changes: 1 addition & 1 deletion src/uucore/src/lib/features/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ pub fn paths_refer_to_same_file<P: AsRef<Path>>(p1: P, p2: P, dereference: bool)
}

/// Converts absolute `path` to be relative to absolute `to` path.
pub fn make_path_relative_to<P: AsRef<Path>>(path: P, to: P) -> PathBuf {
pub fn make_path_relative_to<P1: AsRef<Path>, P2: AsRef<Path>>(path: P1, to: P2) -> PathBuf {
let path = path.as_ref();
let to = to.as_ref();
let common_prefix_size = path
Expand Down

0 comments on commit 9f2a9fa

Please sign in to comment.