From dda81546dec3dcb83d0e24136fe2e30503bd3cd3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 3 Mar 2023 19:13:15 +0100 Subject: [PATCH] main: add map_path() method to Config struct --- src/main.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 5c40ffa..381a0fd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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(()) }