Merge remote-tracking branch 'origin/dev/1.2' into dev/1.3

This commit is contained in:
shedaniel
2023-09-23 15:53:45 +08:00
2 changed files with 12 additions and 0 deletions

View File

@@ -121,6 +121,12 @@ public class ModProcessor {
}
private void stripNestedJars(Path path) {
try {
ZipUtils.deleteIfExists(path, "META-INF/jarjar/metadata.json");
} catch (IOException e) {
throw new UncheckedIOException("Failed to strip nested jars from %s".formatted(path), e);
}
if (!ZipUtils.contains(path, "fabric.mod.json")) {
if (ZipUtils.contains(path, "quilt.mod.json")) {
// Strip out all contained jar info as we dont want loader to try and load the jars contained in dev.

View File

@@ -184,6 +184,12 @@ public class ZipUtils {
}
}
public static void deleteIfExists(Path zip, String path) throws IOException {
try (FileSystemUtil.Delegate fs = FileSystemUtil.getJarFileSystem(zip, false)) {
Files.deleteIfExists(fs.getPath(path));
}
}
public static int transformString(Path zip, Collection<Pair<String, UnsafeUnaryOperator<String>>> transforms) throws IOException {
return transformString(zip, transforms.stream());
}