Browse Source

Output now creates missing folders

kindlich 4 years ago
parent
commit
48ccb11add
No known key found for this signature in database

+ 5
- 1
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/JavaBytecodeRunUnit.java View File

@@ -92,7 +92,11 @@ public class JavaBytecodeRunUnit {
92 92
 			directory.mkdirs();
93 93
 
94 94
 		for (Map.Entry<String, byte[]> classEntry : classes.entrySet()) {
95
-			File output = new File(directory, classEntry.getKey() + ".class");
95
+			File output = new File(directory, classEntry.getKey().replace('.', File.separatorChar) + ".class");
96
+			if (!output.getParentFile().exists() && !output.getParentFile().mkdirs()) {
97
+				//Throw error?
98
+				continue;
99
+			}
96 100
 			try (FileOutputStream outputStream = new FileOutputStream(output)) {
97 101
 				outputStream.write(classEntry.getValue());
98 102
 			} catch (IOException ex) {

Loading…
Cancel
Save