summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 4eea403..ec0b9ea 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,7 +7,8 @@ use std::path::Path;
fn substitute_vars(word: &str) -> String {
match word {
"~" => env::var("HOME").unwrap(),
- w if w.chars().nth(0) == Some('$') => String::from_str(w).unwrap(),
+ w if w.chars().nth(0).unwrap() == '~' => w.replace("~", env::var("HOME").unwrap().as_str()),
+ w if w.chars().nth(0).unwrap() == '$' => String::from_str(w).unwrap(),
w => String::from_str(w).unwrap()
}
}