From 270a8bca7136e1682afa2d9842035f1b8e48ac71 Mon Sep 17 00:00:00 2001 From: patrick-werner Date: Fri, 26 Jul 2019 19:02:13 +0200 Subject: [PATCH] scanDirectory now scans all subfolders --- .../hl7/fhir/r5/validation/ValidationEngine.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java index 8468a916e..29460297c 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java @@ -504,19 +504,21 @@ public class ValidationEngine { } private Map scanDirectory(File f) throws FileNotFoundException, IOException { - Map res = new HashMap(); + Map res = new HashMap<>(); for (File ff : f.listFiles()) { - if (!isIgnoreFile(ff) && !ff.isDirectory()) { - FhirFormat fmt = checkIsResource(ff.getAbsolutePath()); - if (fmt != null) { - res.put(Utilities.changeFileExt(ff.getName(), "."+fmt.getExtension()), TextFile.fileToBytes(ff.getAbsolutePath())); + if (ff.isDirectory()){ + res.putAll(scanDirectory(ff)); + } + else if (!isIgnoreFile(ff)) { + FhirFormat fmt = checkIsResource(ff.getAbsolutePath()); + if (fmt != null) { + res.put(Utilities.changeFileExt(ff.getName(), "."+fmt.getExtension()), TextFile.fileToBytes(ff.getAbsolutePath())); + } } - } } return res; } - private boolean isIgnoreFile(File ff) { return Utilities.existsInList(ff.getName(), ".DS_Store") || Utilities.existsInList(Utilities.getFileExtension(ff.getName()).toLowerCase(), "md", "css", "js", "png", "gif", "jpg", "html", "tgz", "pack", "zip");