Skip to content

Commit

Permalink
fixes #106, bump patch version
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaeroxe committed Dec 19, 2024
1 parent 36cb494 commit 0c63719
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "which"
version = "7.0.0"
version = "7.0.1"
edition = "2021"
rust-version = "1.70"
authors = ["Harry Fei <tiziyuanfang@gmail.com>, Jacob Kiesel <jake@bitcrafters.co>"]
Expand Down
26 changes: 14 additions & 12 deletions src/finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,20 +266,22 @@ fn tilde_expansion(p: &PathBuf) -> Cow<'_, PathBuf> {
let mut component_iter = p.components();
if let Some(Component::Normal(o)) = component_iter.next() {
if o == "~" {
let mut new_path = env_home_dir().unwrap_or_default();
new_path.extend(component_iter);
#[cfg(feature = "tracing")]
tracing::trace!(
"found tilde, substituting in user's home directory to get {}",
new_path.display()
);
Cow::Owned(new_path)
} else {
Cow::Borrowed(p)
let new_path = env_home_dir();
if let Some(mut new_path) = new_path {
new_path.extend(component_iter);
#[cfg(feature = "tracing")]
tracing::trace!(
"found tilde, substituting in user's home directory to get {}",
new_path.display()
);
return Cow::Owned(new_path);
} else {
#[cfg(feature = "tracing")]
tracing::trace!("found tilde in path, but user's home directory couldn't be found");
}
}
} else {
Cow::Borrowed(p)
}
Cow::Borrowed(p)
}

#[cfg(target_os = "windows")]
Expand Down

0 comments on commit 0c63719

Please sign in to comment.