pub fn expand_path(path: &str) -> StringExpand description
Expand ~/ and $HOME / ${HOME} in a path string.
Handles three forms:
- Leading
~/→ replaced with the home directory ~alone → replaced with the home directory$HOMEor${HOME}anywhere in the string → replaced with the home dir
The home directory is resolved from HOME, falling back to USERPROFILE
on Windows. Other environment variables and absolute paths are returned
unchanged. Returns the input unchanged if no home variable is set.