Skip to content

Commit

Permalink
Clean up file reader
Browse files Browse the repository at this point in the history
  • Loading branch information
DrZoddiak committed Mar 28, 2024
1 parent 7394aca commit 5f28bd1
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions crates/ore_monitor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,15 @@ pub mod file_reader {
/// assert_eq!(file,mod_info);
/// ```
pub fn handle_file(&self, path: Option<&Path>) -> Result<OreModInfo> {
Ok(path.unwrap_or(self.base_path.deref()))
let mut reader = Ok(path.unwrap_or(self.base_path.deref()))
.map(File::open)?
.map(BufReader::new)
.map(ZipArchive::new)?
.map(JarFileReader::new)
.map(|mut reader| {
FileTypes::InfoFile
.try_get(&mut reader)
.or_else(|_| FileTypes::PluginFile.try_get(&mut reader))
})?
.map(JarFileReader::new)?;

FileTypes::InfoFile
.try_get(&mut reader)
.or_else(|_| FileTypes::PluginFile.try_get(&mut reader))
}
}

Expand Down

0 comments on commit 5f28bd1

Please sign in to comment.