fix minor bugs loading packages

This commit is contained in:
Grahame Grieve 2020-03-03 07:38:52 +11:00
parent 5cf87b8814
commit d6018f26c8
1 changed files with 7 additions and 3 deletions

View File

@ -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));
}
}