Skip to main content

expand_path

Function expand_path 

Source
pub fn expand_path(raw: &str, ssh_dir: &Path) -> PathBuf
Expand description

Expand a path that may start with ~ or be relative.

Handles the common SSH config path expansion logic:

  • ~/path expands to $HOME/path
  • bare ~ expands to $HOME
  • Relative paths are resolved against ssh_dir
  • Absolute paths are returned as-is

When dirs::home_dir() returns None, ~/ and bare ~ paths are returned unchanged as a PathBuf.