fn download_zip(base: &Path) -> Result<PathBuf, io::Error> {
    let mut zip_path = base.to_owned();
    zip_path.push(ZIP_NAME);
    if zip_path.is_file() {
        return Ok(zip_path);
    }
    let http = Client::new();
    let mut zip_file = try!(fs::File::create(&zip_path));
    match http.get(DOWNLOAD_URL)
              .header(Connection::close())
              .send() {
        Ok(mut res) => {
            try!(io::copy(&mut res, &mut zip_file));

            Ok(zip_path)
        }
        Err(e) => {
            Err(io::Error::new(io::ErrorKind::Other,
                               format!("Could not download the font: {}", e)))
        }
    }
}
/// Download the zipped font file in a wellknown location.
Download the zipped font file in a wellknown location.
Download the zipped font file in a wellknown location .
fn download_zip(base: &Path) -> Result<PathBuf, io::Error> {
    let mut zip_path = base.to_owned();
    zip_path.push(ZIP_NAME);
    if zip_path.is_file() {
        return Ok(zip_path);
    }
    let http = Client::new();
    let mut zip_file = try!(fs::File::create(&zip_path));
    match http.get(DOWNLOAD_URL)
              .header(Connection::close())
              .send() {
        Ok(mut res) => {
            try!(io::copy(&mut res, &mut zip_file));
            Ok(zip_path)
        }
        Err(e) => {
            Err(io::Error::new(io::ErrorKind::Other,
                               format!("Could not download the font: {}", e)))
        }
    }
}
fn download_zip ( base : & Path ) -> Result < PathBuf , io :: Error > { let mut zip_path = base . to_owned ( ) ; zip_path . push ( ZIP_NAME ) ; if zip_path . is_file ( ) { return Ok ( zip_path ) ; } let http = Client :: new ( ) ; let mut zip_file = try ! ( fs File create ( zip_path ) ) ; match http . get ( DOWNLOAD_URL ) . header ( Connection :: close ( ) ) . send ( ) { Ok ( mut res ) => { try ! ( io copy ( mut res mut zip_file ) ) ; Ok ( zip_path ) } Err ( e ) => { Err ( io :: Error :: new ( io :: ErrorKind :: Other , format ! ( " " e ) ) ) } } }
Download the zipped font file in a wellknown location.
Download the zipped font file in a wellknown location .
base
&Path
base
&Path