Skip to content

Instantly share code, notes, and snippets.

@sdepold
Created December 23, 2012 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdepold/4363267 to your computer and use it in GitHub Desktop.
Save sdepold/4363267 to your computer and use it in GitHub Desktop.
fn get_path_to(target: & str, opt: Option<&str>) -> Path {
let path: ~str = match target {
"root" => {
os::homedir().unwrap().to_str() + "/.rsvm"
}
"version" => {
get_path_to(~"root", None).to_str() + ~"/v" + opt.unwrap()
}
"src_archive" => {
get_path_to("version", opt).to_str() + "/src/rust-" + opt.unwrap() + ".tar.gz"
}
_ => {
os::homedir().unwrap().to_str() + "/.rsvm"
}
};
Path(path)
}
==>
if get_path_to("src_archive", Some(version)).exists() {
io::println(~"already done");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment