mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-05 01:24:53 +01:00
core: region_processor: ignore empty region files
Minecraft generates empty region files in some cases. Just ignore these files instead of printing an error message for each.
This commit is contained in:
parent
66189d279c
commit
e74e7be686
2 changed files with 18 additions and 5 deletions
|
@ -8,6 +8,10 @@
|
||||||
|
|
||||||
The calculation of the number of skipped regions could underflow when more invalid than valid
|
The calculation of the number of skipped regions could underflow when more invalid than valid
|
||||||
regions were encountered.
|
regions were encountered.
|
||||||
|
- Ignore empty region files instead of treating them as invalid
|
||||||
|
|
||||||
|
Minecraft generates empty region files in some cases. Just ignore them instead of printing an
|
||||||
|
error message every time.
|
||||||
|
|
||||||
## [2.1.0] - 2024-01-27
|
## [2.1.0] - 2024-01-27
|
||||||
|
|
||||||
|
|
|
@ -337,11 +337,20 @@ impl<'a> RegionProcessor<'a> {
|
||||||
})?
|
})?
|
||||||
.filter_map(|entry| entry.ok())
|
.filter_map(|entry| entry.ok())
|
||||||
.filter(|entry| {
|
.filter(|entry| {
|
||||||
|
(|| {
|
||||||
// We are only interested in regular files
|
// We are only interested in regular files
|
||||||
matches!(
|
let file_type = entry.file_type().ok()?;
|
||||||
entry.file_type().map(|file_type| file_type.is_file()),
|
if !file_type.is_file() {
|
||||||
Ok(true)
|
return None;
|
||||||
)
|
}
|
||||||
|
|
||||||
|
let metadata = entry.metadata().ok()?;
|
||||||
|
if metadata.len() == 0 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
Some(())
|
||||||
|
})()
|
||||||
|
.is_some()
|
||||||
})
|
})
|
||||||
.filter_map(|entry| parse_region_filename(&entry.file_name()))
|
.filter_map(|entry| parse_region_filename(&entry.file_name()))
|
||||||
.collect())
|
.collect())
|
||||||
|
|
Loading…
Add table
Reference in a new issue