pub fn expand_home_dir(path: &str) -> Result<PathBuf, String>
Expand ~ at the start of a path to the home directory. Rejects ~user/ and paths containing .. components (path traversal).
~
~user/
..