Skip to content

fix: automatic map download #532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions crates/hyperion/src/simulation/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,27 @@ pub async fn get_proof_of_concept_save() -> anyhow::Result<PathBuf> {
.context("failed to create .hyperion")?;
}

let new_york_dir = hyperion.join("ProofOfConcept");
let new_york_dir = hyperion.join("NewYork");

if new_york_dir.exists() {
info!("using cached ProofOfConcept load");
info!("using cached NewYork load");
} else {
// download
info!("downloading ProofOfConcept.tar.gz");
info!("downloading NewYork.tar.gz");

// https://github.com/andrewgazelka/maps/raw/main/ProofOfConcept.tar.gz
let url = "https://github.com/andrewgazelka/maps/raw/main/ProofOfConcept.tar.gz";
// https://github.com/andrewgazelka/maps/raw/main/NewYork.tar.gz
let url = "https://github.com/andrewgazelka/maps/raw/main/NewYork.tar.gz";

let response = reqwest::get(url)
.await
.context("failed to get ProofOfConcept.tar.gz")?;
.context("failed to get NewYork.tar.gz")?;

let bytes = response
.bytes()
.await
.context("failed to get response bytes")?;

info!("extracting ProofOfConcept.tar.gz");
info!("extracting NewYork.tar.gz");

let decompressed = GzDecoder::new(bytes.as_ref());

Expand All @@ -156,7 +156,7 @@ pub async fn get_proof_of_concept_save() -> anyhow::Result<PathBuf> {

archive
.unpack(&hyperion)
.context("failed to unpack ProofOfConcept.tar.gz")?;
.context("failed to unpack NewYork.tar.gz")?;
}

Ok(new_york_dir)
Expand Down