Skip to content

Instantly share code, notes, and snippets.

@killerswan
Created August 23, 2012 19:42
Show Gist options
  • Save killerswan/3440741 to your computer and use it in GitHub Desktop.
Save killerswan/3440741 to your computer and use it in GitHub Desktop.
by reference (1)
fn getenv_nonempty(v: &Path) -> option<Path> {
match getenv(*v) {
some(x) =>
if str::is_empty(x) {
none
} else {
some(x)
},
_ => none
}
}
#[cfg(unix)]
fn lookup() -> Path {
option::get_default(getenv_nonempty(&(~"TMPDIR")), ~"/tmp")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment