Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev/1.2' into dev/1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Sep 23, 2023
2 parents 2b64c2f + fce31a4 commit ec6b2b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ private String describeConfiguration(Configuration configuration) {
}

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.
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/fabricmc/loom/util/ZipUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ public static void replace(Path zip, String path, byte[] bytes) throws IOExcepti
}
}

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());
}
Expand Down

0 comments on commit ec6b2b0

Please sign in to comment.