- small cosmetic changes

This commit is contained in:
w.pomp
2026-07-22 13:40:27 +02:00
parent 0d347b7967
commit a5ec4125f9
5 changed files with 13 additions and 11 deletions
+5 -5
View File
@@ -470,15 +470,15 @@ impl Drop for BioFormatsJavaReader {
}
}
fn find_tiff(path: PathBuf) -> Result<Option<PathBuf>, Error> {
fn find_tiff(path: &Path) -> Result<Option<PathBuf>, Error> {
if let Some(ext) = path.extension()
&& path.is_file()
&& (["tif", "tiff"].contains(&ext.to_string_lossy().to_lowercase().as_str()))
{
return Ok(Some(path));
return Ok(Some(path.to_path_buf()));
} else if path.is_dir() {
for file in path.read_dir()?.flatten().sorted_by_key(|i| i.file_name()) {
if let Ok(Some(file)) = find_tiff(file.path()) {
if let Ok(Some(file)) = find_tiff(file.path().as_path()) {
return Ok(Some(file));
}
}
@@ -495,7 +495,7 @@ impl Reader for BioFormatsJavaReader {
let mut path = path.as_ref().to_path_buf();
if path.is_dir() {
let orig = path.clone();
path = find_tiff(path)?.ok_or_else(|| {
path = find_tiff(&path)?.ok_or_else(|| {
Error::FileDoesNotExist(orig.join("**").join("*.tif").display().to_string())
})?;
}
@@ -572,7 +572,7 @@ impl Reader for BioFormatsJavaReader {
let mut path = path.as_ref().to_path_buf();
if path.is_dir() {
let orig = path.clone();
path = find_tiff(path)?.ok_or_else(|| {
path = find_tiff(&path)?.ok_or_else(|| {
Error::FileDoesNotExist(orig.join("**").join("*.tif").display().to_string())
})?;
}