pub fn homedir() -> Option<Path> {
    // FIXME (#7188): getenv needs a ~[u8] variant
    return match getenv("HOME") {
        Some(ref p) if !p.is_empty() => Path::new_opt(p.as_slice()),
        _ => secondary()
    };

    #[cfg(unix)]
    fn secondary() -> Option<Path> {
        None
    }

    #[cfg(windows)]
    fn secondary() -> Option<Path> {
        getenv("USERPROFILE").and_then(|p| {
            if !p.is_empty() {
                Path::new_opt(p)
            } else {
                None
            }
        })
    }
}
/**
 * Returns the path to the user's home directory, if known.
 *
 * On Unix, returns the value of the 'HOME' environment variable if it is set
 * and not equal to the empty string.
 *
 * On Windows, returns the value of the 'HOME' environment variable if it is
 * set and not equal to the empty string. Otherwise, returns the value of the
 * 'USERPROFILE' environment variable if it is set and not equal to the empty
 * string.
 *
 * Otherwise, homedir returns option::none.
 */
Returns the path to the user's home directory, if known.
On Unix, returns the value of the 'HOME' environment variable if it is set
and not equal to the empty string.

On Windows, returns the value of the 'HOME' environment variable if it is
set and not equal to the empty string. Otherwise, returns the value of the
'USERPROFILE' environment variable if it is set and not equal to the empty
string.

Otherwise, homedir returns option::none.
Returns the path to the user ' s home directory if known . On Unix returns the value of the ' HOME ' environment variable if it is set and not equal to the empty string . On Windows returns the value of the ' HOME ' environment variable if it is set and not equal to the empty string . Otherwise returns the value of the ' USERPROFILE ' environment variable if it is set and not equal to the empty string . Otherwise homedir returns option :: none .
pub fn homedir() -> Option<Path> {
    // FIXME (#7188): getenv needs a ~[u8] variant
    return match getenv("HOME") {
        Some(ref p) if !p.is_empty() => Path::new_opt(p.as_slice()),
        _ => secondary()
    };
    #[cfg(unix)]
    fn secondary() -> Option<Path> {
        None
    }
    #[cfg(windows)]
    fn secondary() -> Option<Path> {
        getenv("USERPROFILE").and_then(|p| {
            if !p.is_empty() {
                Path::new_opt(p)
            } else {
                None
            }
        })
    }
}
pub fn homedir ( ) -> Option < Path > { // FIXME (#7188): getenv needs a ~[u8] variant return match getenv ( " " ) { Some ( ref p ) if ! p . is_empty ( ) => Path :: new_opt ( p . as_slice ( ) ) , _ => secondary ( ) } ; # [ cfg ( unix ) ] fn secondary ( ) -> Option < Path > { None } # [ cfg ( windows ) ] fn secondary ( ) -> Option < Path > { getenv ( " " ) . and_then ( | p | { if ! p . is_empty ( ) { Path :: new_opt ( p ) } else { None } } ) } }
Returns the path to the user's home directory, if known.
Returns the path to the user ' s home directory if known .