main: add map_path() method to Config struct

This commit is contained in:
Matthias Schiffer 2023-03-03 19:13:15 +01:00
parent 51a0e178b1
commit dda81546de
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C

View file

@ -46,6 +46,16 @@ impl Config {
);
[&self.processed_dir, Path::new(&filename)].iter().collect()
}
fn map_path(&self, coords: RegionCoords, temp: bool) -> PathBuf {
let filename = format!(
"r.{}.{}.png{}",
coords.0,
coords.1,
if temp { ".tmp" } else { "" },
);
[&self.map_dir, Path::new(&filename)].iter().collect()
}
}
/// Type with methods for processing the regions of a Minecraft save directory
@ -178,7 +188,14 @@ impl<'a> TileRenderer<'a> {
}
fn render_tile(&self, coords: RegionCoords) -> Result<()> {
println!("Rendering tile r.{}.{}.png", coords.0, coords.1);
let output_path = self.config.map_path(coords, false);
println!(
"Rendering tile {}",
output_path
.file_name()
.unwrap_or_default()
.to_string_lossy(),
);
Ok(())
}