mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
main: return list of region coordinates from process_region_dir()
This commit is contained in:
parent
194715ad09
commit
ca6afa0cf9
1 changed files with 8 additions and 2 deletions
10
src/main.rs
10
src/main.rs
|
@ -102,7 +102,9 @@ impl RegionProcessor {
|
|||
}
|
||||
|
||||
/// Iterates over all region files of a Minecraft save directory
|
||||
fn process_region_dir(&self, regiondir: &Path) -> Result<()> {
|
||||
///
|
||||
/// Returns a list of the coordinates of all processed regions
|
||||
fn process_region_dir(&self, regiondir: &Path) -> Result<Vec<RegionCoords>> {
|
||||
let read_dir = regiondir
|
||||
.read_dir()
|
||||
.with_context(|| format!("Failed to read directory {}", regiondir.display()))?;
|
||||
|
@ -114,6 +116,8 @@ impl RegionProcessor {
|
|||
)
|
||||
})?;
|
||||
|
||||
let mut ret = Vec::new();
|
||||
|
||||
for entry in read_dir.filter_map(|entry| entry.ok()).filter(|entry| {
|
||||
// We are only interested in regular files
|
||||
entry
|
||||
|
@ -132,9 +136,11 @@ impl RegionProcessor {
|
|||
coords.0, coords.1, err,
|
||||
);
|
||||
}
|
||||
|
||||
ret.push(coords);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
Ok(ret)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue