fix: cannot find mod metadata in workspace
@@ -32,10 +32,11 @@ public class ModMetadataFinder {
JsonObject jo = null;
for (Path source : sources) {
- try {
if (Files.isDirectory(source)) {
try (Reader reader = new InputStreamReader(Files.newInputStream(source.resolve(fileName)))) {
jo = JsonUtils.DEFAULT_JSON_PARSER.parse(reader).getAsJsonObject();
+ } catch (IOException e) {
+ throw new InvalidModMetadataException(sources, e);
}
} else {
try (JarFile jarFile = new JarFile(source.toFile())) {
@@ -47,13 +48,16 @@ public class ModMetadataFinder {
try (Reader reader = new InputStreamReader(jarFile.getInputStream(jarEntry))) {
jo = JsonUtils.DEFAULT_JSON_PARSER.parse(reader).getAsJsonObject();
}
- }
- }
} catch (IOException e) {
throw new InvalidModMetadataException(sources, e);
}
}
+ if (jo != null) {
+ break;
+ }
+ }
+
if (jo == null) {
throw new InvalidModMetadataException(sources);
}
