fix IG pbulisher geneerated packages to use sub-directores of package

This commit is contained in:
Grahame Grieve 2019-12-05 04:11:35 +11:00
parent 6defa62f4e
commit a83233ca46
1 changed files with 15 additions and 11 deletions

View File

@ -72,15 +72,15 @@ public class NPMPackageGenerator {
private String getDirectory() { private String getDirectory() {
switch (this) { switch (this) {
case RESOURCE: return "/package/"; case RESOURCE: return "package/";
case EXAMPLE: return "/example/"; case EXAMPLE: return "example/";
case OPENAPI: return "/openapi/"; case OPENAPI: return "openapi/";
case SCHEMATRON: return "/xml/"; case SCHEMATRON: return "xml/";
case RDF: return "/rdf/"; case RDF: return "rdf/";
case OTHER: return "/other/"; case OTHER: return "other/";
case TEMPLATE: return "/other/"; case TEMPLATE: return "other/";
case JEKYLL: return "/jekyll/"; case JEKYLL: return "jekyll/";
case TOOL: return "/bin/"; case TOOL: return "bin/";
} }
return "/"; return "/";
} }
@ -294,9 +294,13 @@ public class NPMPackageGenerator {
public void addFile(Category cat, String name, byte[] content) throws IOException { public void addFile(Category cat, String name, byte[] content) throws IOException {
String path = cat.getDirectory()+name; String path = cat.getDirectory()+name;
if (created.contains(path)) if (!path.startsWith("package/")) {
path = "package/" +path;
}
if (created.contains(path)) {
System.out.println("Duplicate package file "+path); System.out.println("Duplicate package file "+path);
else { } else {
created.add(path); created.add(path);
TarArchiveEntry entry = new TarArchiveEntry(path); TarArchiveEntry entry = new TarArchiveEntry(path);
entry.setSize(content.length); entry.setSize(content.length);