Merge pull request #65 from hapifhir/iterate-subfolders
scanDirectory now scans all subfolders
This commit is contained in:
commit
539eee9266
|
@ -506,19 +506,21 @@ 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()){
|
||||||
FhirFormat fmt = checkIsResource(ff.getAbsolutePath());
|
res.putAll(scanDirectory(ff));
|
||||||
if (fmt != null) {
|
}
|
||||||
res.put(Utilities.changeFileExt(ff.getName(), "."+fmt.getExtension()), TextFile.fileToBytes(ff.getAbsolutePath()));
|
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;
|
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");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue