Skip to content
Snippets Groups Projects
Commit 7ac1ead1 authored by stratact's avatar stratact
Browse files

:toilet: Cleanup unneeded(?) tilde expansion code

parent 272a9676
No related branches found
No related tags found
No related merge requests found
...@@ -336,36 +336,12 @@ impl Variables { ...@@ -336,36 +336,12 @@ impl Variables {
} }
} }
_ => { _ => {
let neg; match tilde_prefix.parse() {
let tilde_num; Ok(num) => if let Some(path) = dir_stack.dir_from_top(num) {
return Some(path.to_str().unwrap().to_string());
if tilde_prefix.starts_with('+') {
tilde_num = &tilde_prefix[1..];
neg = false;
} else if tilde_prefix.starts_with('-') {
tilde_num = &tilde_prefix[1..];
neg = true;
} else {
tilde_num = tilde_prefix;
neg = false;
}
match tilde_num.parse() {
Ok(num) => {
let res = if neg {
dir_stack.dir_from_top(num)
} else {
dir_stack.dir_from_bottom(num)
};
if let Some(path) = res {
return Some(path.to_str().unwrap().to_string());
}
} }
Err(_) => { Err(_) => if let Some(home) = self_sys::get_user_home(tilde_prefix) {
if let Some(home) = self_sys::get_user_home(tilde_prefix) { return Some(home + remainder);
return Some(home + remainder);
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment