Skip to content

Commit 0c63719

Browse files
committed
fixes #106, bump patch version
1 parent 36cb494 commit 0c63719

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "which"
3-
version = "7.0.0"
3+
version = "7.0.1"
44
edition = "2021"
55
rust-version = "1.70"
66
authors = ["Harry Fei <[email protected]>, Jacob Kiesel <[email protected]>"]

src/finder.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,20 +266,22 @@ fn tilde_expansion(p: &PathBuf) -> Cow<'_, PathBuf> {
266266
let mut component_iter = p.components();
267267
if let Some(Component::Normal(o)) = component_iter.next() {
268268
if o == "~" {
269-
let mut new_path = env_home_dir().unwrap_or_default();
270-
new_path.extend(component_iter);
271-
#[cfg(feature = "tracing")]
272-
tracing::trace!(
273-
"found tilde, substituting in user's home directory to get {}",
274-
new_path.display()
275-
);
276-
Cow::Owned(new_path)
277-
} else {
278-
Cow::Borrowed(p)
269+
let new_path = env_home_dir();
270+
if let Some(mut new_path) = new_path {
271+
new_path.extend(component_iter);
272+
#[cfg(feature = "tracing")]
273+
tracing::trace!(
274+
"found tilde, substituting in user's home directory to get {}",
275+
new_path.display()
276+
);
277+
return Cow::Owned(new_path);
278+
} else {
279+
#[cfg(feature = "tracing")]
280+
tracing::trace!("found tilde in path, but user's home directory couldn't be found");
281+
}
279282
}
280-
} else {
281-
Cow::Borrowed(p)
282283
}
284+
Cow::Borrowed(p)
283285
}
284286

285287
#[cfg(target_os = "windows")]

0 commit comments

Comments
 (0)