scanDirectory now scans all subfolders

This commit is contained in:
patrick-werner 2019-07-26 19:02:13 +02:00
parent 94feb31bef
commit 270a8bca71
1 changed files with 9 additions and 7 deletions

View File

@ -504,9 +504,12 @@ public class ValidationEngine {
} }
private Map<String, byte[]> scanDirectory(File f) throws FileNotFoundException, IOException { private Map<String, byte[]> scanDirectory(File f) throws FileNotFoundException, IOException {
Map<String, byte[]> res = new HashMap<String, byte[]>(); Map<String, byte[]> res = new HashMap<>();
for (File ff : f.listFiles()) { for (File ff : f.listFiles()) {
if (!isIgnoreFile(ff) && !ff.isDirectory()) { if (ff.isDirectory()){
res.putAll(scanDirectory(ff));
}
else if (!isIgnoreFile(ff)) {
FhirFormat fmt = checkIsResource(ff.getAbsolutePath()); FhirFormat fmt = checkIsResource(ff.getAbsolutePath());
if (fmt != null) { if (fmt != null) {
res.put(Utilities.changeFileExt(ff.getName(), "."+fmt.getExtension()), TextFile.fileToBytes(ff.getAbsolutePath())); res.put(Utilities.changeFileExt(ff.getName(), "."+fmt.getExtension()), TextFile.fileToBytes(ff.getAbsolutePath()));
@ -516,7 +519,6 @@ public class ValidationEngine {
return res; return res;
} }
private boolean isIgnoreFile(File ff) { 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"); return Utilities.existsInList(ff.getName(), ".DS_Store") || Utilities.existsInList(Utilities.getFileExtension(ff.getName()).toLowerCase(), "md", "css", "js", "png", "gif", "jpg", "html", "tgz", "pack", "zip");