Skip to content

Commit

Permalink
Bake less huge data files into the .wasm. #21
Browse files Browse the repository at this point in the history
This has the effect of breaking the city loader, because it lists
bundled files to discover other cities. Going to rethink that next.
  • Loading branch information
dabreegster committed Oct 8, 2020
1 parent 64bc4ee commit fa49817
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion abstutil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ serde_json = "1.0.57"
termion = "1.5.1"

[target.'cfg(target_arch = "wasm32")'.dependencies]
include_dir = "0.6.0"
include_dir = { git = "https://github.com/dabreegster/include_dir", branch = "union" }
11 changes: 10 additions & 1 deletion abstutil/src/io_web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ use serde::de::DeserializeOwned;
use serde::Serialize;
use std::io::{Error, ErrorKind};

static SYSTEM_DATA: include_dir::Dir = include_dir::include_dir!("../data/system");
// Bring in everything from data/system/ matching one of the prefixes -- aka, no scenarios, and
// only the smallest map. Everything else has to be dynamically loaded over HTTP.
static SYSTEM_DATA: include_dir::Dir = include_dir::include_dir!(
"../data/system",
"assets/",
"cities/",
"fonts/",
"maps/montlake.bin",
"proposals/"
);

pub fn file_exists<I: Into<String>>(path: I) -> bool {
SYSTEM_DATA
Expand Down

0 comments on commit fa49817

Please sign in to comment.