Skip to content

Commit

Permalink
RemapJarTask: Delete output if it exists to prevent ghost files
Browse files Browse the repository at this point in the history
Fixes FabricMC#1270. This changed isn't necessary for
RemapSourcesJarTask as SourceRemapperService already deletes
the output.
  • Loading branch information
Juuxel committed Mar 4, 2025
1 parent 7204a7d commit c61a6a2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/net/fabricmc/loom/task/RemapJarTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ private void remap() throws IOException {
Objects.requireNonNull(tinyRemapperService, "tinyRemapperService");
Objects.requireNonNull(tinyRemapper, "tinyRemapper");

// Delete the old file to prevent deleted contents from sticking around in the jar.
Files.deleteIfExists(outputFile);

try (OutputConsumerPath outputConsumer = new OutputConsumerPath.Builder(outputFile).build()) {
outputConsumer.addNonClassFiles(inputFile);
tinyRemapper.apply(outputConsumer, tinyRemapperService.getOrCreateTag(inputFile));
Expand Down

0 comments on commit c61a6a2

Please sign in to comment.