more debugging

This commit is contained in:
Grahame Grieve 2019-12-05 17:43:55 +11:00
parent 7f061c6032
commit 0894226f52
1 changed files with 7 additions and 4 deletions

View File

@ -185,14 +185,17 @@ public class NpmPackage {
} }
public static void loadFiles(NpmPackage res, String path, File source, String... exemptions) throws FileNotFoundException, IOException { public static void loadFiles(NpmPackage res, String path, File source, String... exemptions) throws FileNotFoundException, IOException {
System.out.println("Load Package from "+path);
res.npm = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(Utilities.path(path, "package", "package.json"))); res.npm = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(Utilities.path(path, "package", "package.json")));
for (File f : new File(path).listFiles()) { File dir = new File(path);
for (File f : dir.listFiles()) {
if (f.isDirectory()) { if (f.isDirectory()) {
String d = f.getName(); String d = f.getName();
if (!d.equals("package")) { if (!d.equals("package")) {
d = Utilities.path("package", d); d = Utilities.path("package", d);
} }
System.out.println(" see "+f.getAbsolutePath()+" as "+d);
NpmPackageFolder folder = res.new NpmPackageFolder(d); NpmPackageFolder folder = res.new NpmPackageFolder(d);
folder.folder = f; folder.folder = f;
res.folders.put(f.getName(), folder); res.folders.put(f.getName(), folder);
@ -204,7 +207,7 @@ public class NpmPackage {
throw new IOException("Error parsing "+ij.getAbsolutePath()+": "+e.getMessage(), e); throw new IOException("Error parsing "+ij.getAbsolutePath()+": "+e.getMessage(), e);
} }
} }
loadSubFolders(res, path, f); loadSubFolders(res, dir.getAbsolutePath(), f);
} }
} }
} }
@ -216,7 +219,7 @@ public class NpmPackage {
if (!d.startsWith("package")) { if (!d.startsWith("package")) {
d = Utilities.path("package", d); d = Utilities.path("package", d);
} }
System.out.println(" see "+f.getAbsolutePath()+" as "+d);
NpmPackageFolder folder = res.new NpmPackageFolder(d); NpmPackageFolder folder = res.new NpmPackageFolder(d);
folder.folder = f; folder.folder = f;
res.folders.put(d, folder); res.folders.put(d, folder);
@ -237,7 +240,7 @@ public class NpmPackage {
public static NpmPackage fromFolder(String folder, PackageType defType, String... exemptions) throws IOException { public static NpmPackage fromFolder(String folder, PackageType defType, String... exemptions) throws IOException {
NpmPackage res = new NpmPackage(); NpmPackage res = new NpmPackage();
loadFiles(res, folder, new File(folder), exemptions); loadFiles(res, folder, new File(folder), exemptions);
if (res.folders.containsKey("package")) { if (!res.folders.containsKey("package")) {
res.folders.put("package", res.new NpmPackageFolder("package")); res.folders.put("package", res.new NpmPackageFolder("package"));
} }
if (!res.folders.get("package").content.containsKey("package/package.json") && defType != null) if (!res.folders.get("package").content.containsKey("package/package.json") && defType != null)