Skip to content

Commit

Permalink
Fix access transformer error when directory doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeregorix committed Dec 26, 2024
1 parent d1f83fd commit a70cf80
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

public class AWToAT {
private static final Logger logger = Logging.getLogger(AWToAT.class);
Expand All @@ -58,8 +59,13 @@ public static void convert(final Iterable<File> awFiles, final File atFile) {
}
}

try (final BufferedWriter writer = Files.newBufferedWriter(atFile.toPath())) {
AccessTransformFormats.FML.write(writer, at);
try {
final Path atPath = atFile.toPath();
Files.createDirectories(atPath.getParent());

try (final BufferedWriter writer = Files.newBufferedWriter(atPath)) {
AccessTransformFormats.FML.write(writer, at);
}
} catch (IOException e) {
throw new GradleException("Failed to write access transformer: " + atFile, e);
}
Expand Down

0 comments on commit a70cf80

Please sign in to comment.