From 0feec6f3b06991a29e185a5540d378b5b0aab70e Mon Sep 17 00:00:00 2001 From: David Gault Date: Fri, 10 May 2024 13:33:51 +0100 Subject: [PATCH] Flex: add try catch for traversing parent dirs --- .../src/loci/formats/in/FlexReader.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/formats-gpl/src/loci/formats/in/FlexReader.java b/components/formats-gpl/src/loci/formats/in/FlexReader.java index 66802d98b87..38bc81bb089 100644 --- a/components/formats-gpl/src/loci/formats/in/FlexReader.java +++ b/components/formats-gpl/src/loci/formats/in/FlexReader.java @@ -397,6 +397,23 @@ protected void initFile(String id) throws FormatException, IOException { if (!dir.getName().startsWith("Meas_") || !groupPlates()) { runDirs.add(dir); } + else { + try { + // look for other acquisitions of the same plate + dir = dir.getParentFile(); + String[] parentDirs = dir.list(true); + Arrays.sort(parentDirs); + for (String d : parentDirs) { + Location f = new Location(dir.getAbsoluteFile(), d); + if (f.isDirectory() && d.startsWith("Meas_")) { + runDirs.add(f); + } + } + } + catch (Exception e) { + LOGGER.error("Error while traversing parent directories: ", e); + } + } runCount = runDirs.size(); if (runCount == 0) runCount = 1;