Make sure we do not close the jar filesystem when cheking for mods (otherwise resources might fail)
This commit is contained in:
parent
617573ca09
commit
f3bdaaac8e
1 changed files with 11 additions and 10 deletions
|
@ -51,16 +51,17 @@ public class ModUtil {
|
||||||
PathUtil.fileWalker(PathUtil.MOD_FOLDER.toFile(), false, (file -> {
|
PathUtil.fileWalker(PathUtil.MOD_FOLDER.toFile(), false, (file -> {
|
||||||
try {
|
try {
|
||||||
URI uri = URI.create("jar:" + file.toUri());
|
URI uri = URI.create("jar:" + file.toUri());
|
||||||
|
FileSystem fs = FileSystems.getFileSystem(uri);
|
||||||
try (FileSystem fs = FileSystems.getFileSystem(uri)) {
|
if (fs!=null) {
|
||||||
final JarFile jarFile = new JarFile(file.toString());
|
try {
|
||||||
Path modMetaFile = fs.getPath("fabric.mod.json");
|
Path modMetaFile = fs.getPath("fabric.mod.json");
|
||||||
|
if (modMetaFile != null) {
|
||||||
ModMetadata mc = ModMetadataParser.parseMetadata(logger, modMetaFile);
|
ModMetadata mc = ModMetadataParser.parseMetadata(logger, modMetaFile);
|
||||||
mods.put(mc.getId(), new ModInfo(mc, file));
|
mods.put(mc.getId(), new ModInfo(mc, file));
|
||||||
}
|
}
|
||||||
catch (ParseMetadataException e) {
|
} catch (ParseMetadataException e) {
|
||||||
BCLib.LOGGER.error(e.getMessage());
|
BCLib.LOGGER.error(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue