pub fn tmp_dir() -> OsString {
    let mut maybe_dir = var_os("RD_TMPDIR");
    match maybe_dir {
        Some(dir) => {
            ensure_dir(&dir, "temporary file directory (RD_TMPDIR)", Mode::S_IRWXU);
            return dir;
        }
        None => (),
    }

    maybe_dir = var_os("TMPDIR");
    match maybe_dir {
        Some(dir) => {
            ensure_dir(&dir, "temporary file directory (TMPDIR)", Mode::S_IRWXU);
            return dir;
        }
        None => (),
    }

    // Don't try to create "/tmp", that probably won't work well.
    match access("/tmp", AccessFlags::W_OK) {
        Err(e) => fatal!("Can't write to temporary file directory /tmp: {:?}", e),
        Ok(_) => (),
    }

    OsString::from("/tmp")
}
/// Returns $TMPDIR or "/tmp". We call ensure_dir to make sure the directory
/// exists and is writeable.
Returns $TMPDIR or "/tmp". We call ensure_dir to make sure the directory
exists and is writeable.
Returns $TMPDIR or " / tmp " . We call ensure_dir to make sure the directory exists and is writeable .
pub fn tmp_dir() -> OsString {
    let mut maybe_dir = var_os("RD_TMPDIR");
    match maybe_dir {
        Some(dir) => {
            ensure_dir(&dir, "temporary file directory (RD_TMPDIR)", Mode::S_IRWXU);
            return dir;
        }
        None => (),
    }
    maybe_dir = var_os("TMPDIR");
    match maybe_dir {
        Some(dir) => {
            ensure_dir(&dir, "temporary file directory (TMPDIR)", Mode::S_IRWXU);
            return dir;
        }
        None => (),
    }
    // Don't try to create "/tmp", that probably won't work well.
    match access("/tmp", AccessFlags::W_OK) {
        Err(e) => fatal!("Can't write to temporary file directory /tmp: {:?}", e),
        Ok(_) => (),
    }
    OsString::from("/tmp")
}
pub fn tmp_dir ( ) -> OsString { let mut maybe_dir = var_os ( " " ) ; match maybe_dir { Some ( dir ) => { ensure_dir ( & dir , " " , Mode :: S_IRWXU ) ; return dir ; } None => ( ) , } maybe_dir = var_os ( " " ) ; match maybe_dir { Some ( dir ) => { ensure_dir ( & dir , " " , Mode :: S_IRWXU ) ; return dir ; } None => ( ) , } // Don't try to create "/tmp", that probably won't work well. match access ( " " , AccessFlags :: W_OK ) { Err ( e ) => fatal ! ( " " e ) , Ok ( _ ) => ( ) , } OsString :: from ( " " ) }
Returns $TMPDIR or "/tmp".
Returns $TMPDIR or " / tmp " .