This commit is contained in:
Lucas 2024-05-08 16:12:54 +02:00
commit 275eceb80a

View File

@ -4,6 +4,7 @@ import ast.ClassNode;
import ast.FieldNode;
import ast.MemberNode;
import ast.MethodNode;
import java.io.File;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
@ -34,8 +35,13 @@ public class ClassCodeGen {
}
private void printIntoClassFile(byte[] byteCode, String name) {
String filePath = "./classFileOutput/" + name + ".class";
String directoryPath = "src/main/java/classFileOutput";
File directory = new File(directoryPath);
if (!directory.exists()) {
directory.mkdirs();
}
String filePath = directoryPath + "/" + name + ".class";
try {
FileOutputStream fileOutputStream = new FileOutputStream(filePath);
fileOutputStream.write(byteCode);