Skip to content

Commit 1d17821

Browse files
authored
Fix plugins not loading when a ZipFS has already been opened for the current Jar (#475)
1 parent b876b97 commit 1d17821

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/org/jetbrains/java/decompiler/main/plugins/JarPluginLoader.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,11 @@ public class JarPluginLoader {
1313

1414
public static void init() {
1515
try {
16-
File myFile = new File(JarPluginLoader.class.getProtectionDomain().getCodeSource().getLocation().toURI());
16+
Path myFile = Paths.get(JarPluginLoader.class.getProtectionDomain().getCodeSource().getLocation().toURI());
1717

1818
// Ensure we are running out of a file
19-
if (myFile.exists() && !myFile.isDirectory() && myFile.getPath().endsWith(".jar")) {
20-
URI uri = URI.create("jar:" + myFile.toURI());
21-
22-
Map<String, String> env = new HashMap<>();
23-
24-
FileSystem zipfs = FileSystems.newFileSystem(uri, env);
19+
if (Files.isRegularFile(myFile) && myFile.getFileName().toString().endsWith(".jar")) {
20+
FileSystem zipfs = FileSystems.newFileSystem(myFile, (ClassLoader) null);
2521

2622
Path pluginsDir = zipfs.getPath("META-INF", "plugins");
2723
if (!Files.exists(pluginsDir)) {

0 commit comments

Comments
 (0)