From d6018f26c82683e7d7f97bbe95bbc9165760d118 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 3 Mar 2020 07:38:52 +1100 Subject: [PATCH] fix minor bugs loading packages --- .../java/org/hl7/fhir/utilities/cache/NpmPackage.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java index e2abec238..2ab1a3389 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java @@ -200,7 +200,7 @@ public class NpmPackage { File dir = new File(path); for (File f : dir.listFiles()) { - if (!Utilities.existsInList(f.getName(), ".git", ".svn") && !Utilities.existsInList(f.getName(), exemptions)) { + if (!isInternalExemptFile(f) && !Utilities.existsInList(f.getName(), exemptions)) { if (f.isDirectory()) { String d = f.getName(); if (!d.equals("package")) { @@ -227,6 +227,10 @@ public class NpmPackage { } } + public static boolean isInternalExemptFile(File f) { + return Utilities.existsInList(f.getName(), ".git", ".svn") || Utilities.existsInList(f.getName(), "package-list.json"); + } + private static void loadSubFolders(NpmPackage res, String rootPath, File dir) throws IOException { for (File f : dir.listFiles()) { if (f.isDirectory()) { @@ -684,7 +688,7 @@ public class NpmPackage { for (NpmPackageFolder folder : folders.values()) { String n = folder.name; - if (!"package".equals(n)) { + if (!"package".equals(n) && !(n.startsWith("package/") || n.startsWith("package\\"))) { n = "package/"+n; } NpmPackageIndexBuilder indexer = new NpmPackageIndexBuilder(); @@ -828,7 +832,7 @@ public class NpmPackage { NpmPackageFolder pf = folders.get(folder); String p = folder.contains("$") ? path : Utilities.path(path, folder); for (File f : new File(p).listFiles()) { - if (!f.isDirectory()) { + if (!f.isDirectory() && !isInternalExemptFile(f)) { pf.getContent().put(f.getName(), TextFile.fileToBytes(f)); } }