1.0.0[][src]Function std::env::home_dir

pub fn home_dir() -> Option<PathBuf>
Deprecated since 1.29.0:

This function's behavior is unexpected and probably not what you want. Consider using the home_dir function from https://crates.io/crates/dirs instead.

Returns the path of the current user's home directory if known.

Unix

Windows

Examples

use std::env;

match env::home_dir() {
    Some(path) => println!("Your home directory, probably: {}", path.display()),
    None => println!("Impossible to get your home dir!"),
}Run