diff --git a/src/main/java/xyz/wagyourtail/jvmdg/compile/PathDowngrader.java b/src/main/java/xyz/wagyourtail/jvmdg/compile/PathDowngrader.java index 0b139e6a..923f1600 100644 --- a/src/main/java/xyz/wagyourtail/jvmdg/compile/PathDowngrader.java +++ b/src/main/java/xyz/wagyourtail/jvmdg/compile/PathDowngrader.java @@ -114,7 +114,10 @@ public byte[] apply(String s) { for (Map.Entry entry : outputs.entrySet()) { String internal = entry.getKey(); Path p = out.resolve(internal + ".class"); - Files.createDirectories(p.getParent()); + Path parent = p.getParent(); + if (parent != null) { + Files.createDirectories(parent); + } Files.write(p, entry.getValue(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); } } diff --git a/src/main/java/xyz/wagyourtail/jvmdg/compile/ZipDowngrader.java b/src/main/java/xyz/wagyourtail/jvmdg/compile/ZipDowngrader.java index 5f1aac50..aa546f99 100644 --- a/src/main/java/xyz/wagyourtail/jvmdg/compile/ZipDowngrader.java +++ b/src/main/java/xyz/wagyourtail/jvmdg/compile/ZipDowngrader.java @@ -46,7 +46,10 @@ public static void downgradeZip(int opcVersion, Path input, Set classpath, public static void downgradeZip(final ClassDowngrader downgrader, Path zip, Set classpath, final Path output) throws IOException { try (final FileSystem zipfs = Utils.openZipFileSystem(zip, false)) { - Files.createDirectories(output.getParent()); + Path parent = output.getParent(); + if (parent != null) { + Files.createDirectories(parent); + } Files.deleteIfExists(output); try (final FileSystem outputZipFs = Utils.openZipFileSystem(output, true)) { PathDowngrader.downgradePaths(downgrader, Collections.singletonList(zipfs.getPath("/")), Collections.singletonList(outputZipFs.getPath("/")), classpath); diff --git a/src/main/java/xyz/wagyourtail/jvmdg/runtime/Bootstrap.java b/src/main/java/xyz/wagyourtail/jvmdg/runtime/Bootstrap.java index 3cfc2809..e9a2e9fb 100644 --- a/src/main/java/xyz/wagyourtail/jvmdg/runtime/Bootstrap.java +++ b/src/main/java/xyz/wagyourtail/jvmdg/runtime/Bootstrap.java @@ -81,7 +81,6 @@ public static void premain(String args, Instrumentation instrumentation) throws downgrade = true; } if (downgrade) { - Files.createDirectories(tmp.getParent()); for (File file : tmp.getParent().toFile().listFiles()) { if (file.isDirectory()) continue; if (file.getName().startsWith(name + "-downgraded-" + currentVersionDowngrader.target) && file.getName().endsWith(".jar")) {