fn download_prebuilt() -> PathBuf {
    let out_dir = env::var("OUT_DIR").unwrap();

    let archive_name = LATEST_PREBUILT_URL.split("/").last().unwrap();
    let build_path = Path::new(&out_dir).join("filament_prebuilt");
    let archive_path = Path::new(&out_dir).join(archive_name);
    let extracted_done_marker = build_path.join("extract_done_marker");

    create_dir_all(&build_path).unwrap();

    // Avoid re-downloading the archive if needed.
    if !archive_path.exists() {
        download_to(LATEST_PREBUILT_URL, archive_path.to_str().unwrap());
    }

    // Only extract if the marker is missing
    if !extracted_done_marker.exists() {
        let reader = GzDecoder::new(File::open(&archive_path).unwrap());
        let mut ar = tar::Archive::new(reader);
        ar.unpack(&build_path).unwrap();

        // Create a marker that the archive was extracted
        File::create(extracted_done_marker).unwrap();
    }

    if cfg!(target_os = "macos") {
        // The OSX path isn't the same as windows. Which is neat.
        build_path.join("filament")
    } else {
        build_path
    }
}
// Returns the location of the downloaded tarball
Returns the location of the downloaded tarball
Returns the location of the downloaded tarball
fn download_prebuilt() -> PathBuf {
    let out_dir = env::var("OUT_DIR").unwrap();
    let archive_name = LATEST_PREBUILT_URL.split("/").last().unwrap();
    let build_path = Path::new(&out_dir).join("filament_prebuilt");
    let archive_path = Path::new(&out_dir).join(archive_name);
    let extracted_done_marker = build_path.join("extract_done_marker");
    create_dir_all(&build_path).unwrap();
    // Avoid re-downloading the archive if needed.
    if !archive_path.exists() {
        download_to(LATEST_PREBUILT_URL, archive_path.to_str().unwrap());
    }
    // Only extract if the marker is missing
    if !extracted_done_marker.exists() {
        let reader = GzDecoder::new(File::open(&archive_path).unwrap());
        let mut ar = tar::Archive::new(reader);
        ar.unpack(&build_path).unwrap();
        // Create a marker that the archive was extracted
        File::create(extracted_done_marker).unwrap();
    }
    if cfg!(target_os = "macos") {
        // The OSX path isn't the same as windows. Which is neat.
        build_path.join("filament")
    } else {
        build_path
    }
}
fn download_prebuilt ( ) -> PathBuf { let out_dir = env :: var ( " " ) . unwrap ( ) ; let archive_name = LATEST_PREBUILT_URL . split ( " " ) . last ( ) . unwrap ( ) ; let build_path = Path :: new ( & out_dir ) . join ( " " ) ; let archive_path = Path :: new ( & out_dir ) . join ( archive_name ) ; let extracted_done_marker = build_path . join ( " " ) ; create_dir_all ( & build_path ) . unwrap ( ) ; // Avoid re-downloading the archive if needed. if ! archive_path . exists ( ) { download_to ( LATEST_PREBUILT_URL , archive_path . to_str ( ) . unwrap ( ) ) ; } // Only extract if the marker is missing if ! extracted_done_marker . exists ( ) { let reader = GzDecoder :: new ( File :: open ( & archive_path ) . unwrap ( ) ) ; let mut ar = tar :: Archive :: new ( reader ) ; ar . unpack ( & build_path ) . unwrap ( ) ; // Create a marker that the archive was extracted File :: create ( extracted_done_marker ) . unwrap ( ) ; } if cfg ! ( target_os " " ) { // The OSX path isn't the same as windows. Which is neat. build_path . join ( " " ) } else { build_path } }
Returns the location of the downloaded tarball
Returns the location of the downloaded tarball