aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cwd.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cwd.rs b/src/cwd.rs
index 7672981..95b6659 100644
--- a/src/cwd.rs
+++ b/src/cwd.rs
@@ -8,7 +8,11 @@ pub fn cwd() -> colored::ColoredString {
8 let tilde_expand = env::var("EXPAND_TILDE").unwrap_or("0".into()); 8 let tilde_expand = env::var("EXPAND_TILDE").unwrap_or("0".into());
9 9
10 match tilde_expand.as_ref() { 10 match tilde_expand.as_ref() {
11 "0" => path = path.replace(&home[..], "~"), 11 "0" => {
12 if (&path[..]).starts_with(&home[..]) && home.len() > 0 {
13 path = path.replacen(&home[..], "~", 1);
14 }
15 }
12 _ => {} 16 _ => {}
13 }; 17 };
14 18