Support ~

main
Ashelyn Dawn 2 years ago
parent 7205254a78
commit 3c06415a17

@ -1,4 +1,4 @@
ashe@tilde.club's password: ashe@tilde.club's password:
Welcome to AsheOS 21.12.1 LTS (HRT/Estrix 6.25.21-wasm) Welcome to AsheOS 21.12.1 LTS (HRT/Estrix 6.25.21-wasm)
* Technical: https://tempest.dev * Technical: https://tempest.dev

@ -1,8 +1,14 @@
use std::str::FromStr; use std::str::FromStr;
pub fn join(root : &str, path : &str) -> String { pub fn join(root : &str, path : &str) -> String {
let mut path = String::from_str(path).unwrap();
if path.starts_with("~") {
path = path.replace("~", "/home/ashe");
}
if path.starts_with("/") { if path.starts_with("/") {
return String::from_str(path).unwrap() return path
} }
let mut result_segments : Vec<&str> = root.split("/").filter(|s| !s.is_empty()).collect(); let mut result_segments : Vec<&str> = root.split("/").filter(|s| !s.is_empty()).collect();

Loading…
Cancel
Save