fix bug in package generator where files go in the wrong place

This commit is contained in:
Grahame Grieve 2022-01-18 07:30:12 +11:00
parent b34193e5b8
commit 06e690e54f
2 changed files with 13 additions and 12 deletions

View File

@ -1,8 +1,9 @@
## Validator Changes ## Validator Changes
* fix inclusion of Java constants in CLI help text. * no changes
* fix bug on `-compile` output when using 'current' version.
## Other code changes ## Other code changes
n/a * fix bug where generated packages have files in the wrong places
* fix inclusion of Java constants in CLI help text.
* fix bug on `-compile` output when using 'current' version.

View File

@ -80,14 +80,14 @@ 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 "package/example/";
case OPENAPI: return "openapi/"; case OPENAPI: return "package/openapi/";
case SCHEMATRON: return "xml/"; case SCHEMATRON: return "package/xml/";
case RDF: return "rdf/"; case RDF: return "package/rdf/";
case OTHER: return "other/"; case OTHER: return "package/other/";
case TEMPLATE: return "other/"; case TEMPLATE: return "package/other/";
case JEKYLL: return "jekyll/"; case JEKYLL: return "package/jekyll/";
case TOOL: return "bin/"; case TOOL: return "package/bin/";
} }
return "/"; return "/";
} }
@ -323,7 +323,7 @@ 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 (path.length() > 100) { if (path.length() > 100) {
name = name.substring(0, name.indexOf("-"))+"-"+UUID.randomUUID().toString(); name = name.substring(0, name.indexOf("-"))+"-"+UUID.randomUUID().toString()+".json";
path = cat.getDirectory()+name; path = cat.getDirectory()+name;
} }