Fixed bug with linux & cleanup of the java version detector
This commit is contained in:
parent
17c1c90957
commit
e69c675f82
|
@ -191,7 +191,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
|
||||||
.filter(this::containsFiles)
|
.filter(this::containsFiles)
|
||||||
.map(basePath::relativize)
|
.map(basePath::relativize)
|
||||||
.map(Path::toString)
|
.map(Path::toString)
|
||||||
.map(T -> T.replace("\\", "."))
|
.map(this::sanitize)
|
||||||
.forEach(T -> joiner.add("\texports "+T+";"));
|
.forEach(T -> joiner.add("\texports "+T+";"));
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
@ -200,12 +200,18 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("module ").append(basePath.relativize(getOutputFolder()).toString().replace("\\", ".")).append(" {\n");
|
builder.append("module ").append(sanitize(basePath.relativize(getOutputFolder()).toString())).append(" {\n");
|
||||||
builder.append(joiner.toString()).append("}");
|
builder.append(joiner.toString()).append("}");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean containsFiles(Path path) {
|
private String sanitize(String input)
|
||||||
|
{
|
||||||
|
return input.replace("\\", ".").replace("/", ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean containsFiles(Path path)
|
||||||
|
{
|
||||||
try(Stream<Path> stream = Files.walk(path, 1))
|
try(Stream<Path> stream = Files.walk(path, 1))
|
||||||
{
|
{
|
||||||
return stream.filter(Files::isRegularFile).findFirst().isPresent();
|
return stream.filter(Files::isRegularFile).findFirst().isPresent();
|
||||||
|
@ -217,14 +223,12 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getVersion() {
|
private int getVersion()
|
||||||
String version = System.getProperty("java.version");
|
{
|
||||||
if(version.startsWith("1.")) {
|
String version = System.getProperty("java.version");
|
||||||
version = version.substring(2, 3);
|
if(version.startsWith("1.")) return Integer.parseInt(version.substring(2, 3));
|
||||||
} else {
|
int dot = version.indexOf(".");
|
||||||
int dot = version.indexOf(".");
|
return Integer.parseInt(dot != -1 ? version.substring(0, dot) : version);
|
||||||
if(dot != -1) { version = version.substring(0, dot); }
|
|
||||||
} return Integer.parseInt(version);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String...args)
|
public static void main(String...args)
|
||||||
|
|
Loading…
Reference in New Issue