Skip to content

Commit

Permalink
Merge pull request #24 from novalabsxyz/jsk/handle-lower-case-tile-names
Browse files Browse the repository at this point in the history
Properly handle lower case tile names
  • Loading branch information
JayKickliter authored Dec 13, 2023
2 parents b1f4389 + 916bd0f commit 4a45442
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions terrain/src/tiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,15 @@ impl Tiles {
/// Private API.
impl Tiles {
fn load_tile(&self, sw_corner: Coord<i16>) -> Result<Tile, TerrainError> {
let file_name = file_name(sw_corner);
let tile_path: PathBuf = [&self.tile_dir, Path::new(&file_name)].iter().collect();
let tile_path = {
let file_name = file_name(sw_corner);
let mut tile_path: PathBuf = [&self.tile_dir, Path::new(&file_name)].iter().collect();
if !tile_path.exists() {
let file_name = file_name.to_lowercase();
tile_path = [&self.tile_dir, Path::new(&file_name)].iter().collect();
}
tile_path
};
debug!("loading {tile_path:?}");
match self.tile_mode {
TileMode::InMem => Ok(Tile::load(tile_path)?),
Expand Down

0 comments on commit 4a45442

Please sign in to comment.