mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-30 13:13:58 +01:00
Handle the presence of non-JAR files in plugins directory
This commit is contained in:
parent
b7178a10b6
commit
966205d68a
@ -51,6 +51,7 @@ public class Creator {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.severe("Could not walk plugin directory, plugins have not been loaded");
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.plugins = pluginLoader.loadAll();
|
||||
|
||||
|
@ -18,6 +18,7 @@ import java.util.List;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipException;
|
||||
|
||||
@Log
|
||||
public class CreatorPluginLoader extends DirectoryWalker {
|
||||
@ -26,7 +27,13 @@ public class CreatorPluginLoader extends DirectoryWalker {
|
||||
|
||||
@Override
|
||||
protected void onFile(File file, String relPath) throws IOException {
|
||||
JarFile jarFile = new JarFile(file);
|
||||
JarFile jarFile;
|
||||
try {
|
||||
jarFile = new JarFile(file);
|
||||
} catch (ZipException e) {
|
||||
log.warning(String.format("Found a non-JAR file %s in plugins directory", file));
|
||||
return;
|
||||
}
|
||||
|
||||
ZipEntry metaEntry = jarFile.getEntry("skcraftcreator.plugin.json");
|
||||
if (metaEntry != null) {
|
||||
@ -36,6 +43,8 @@ public class CreatorPluginLoader extends DirectoryWalker {
|
||||
|
||||
log.info("Found plugin " + pluginInfo.getId());
|
||||
candidates.add(new PluginCandidate(pluginInfo, file.toURI().toURL()));
|
||||
} else {
|
||||
log.warning(String.format("Found a non-plugin JAR file: %s", file));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user