Browse Source

Output now creates missing folders

kindlich 5 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
 			directory.mkdirs();
92
 			directory.mkdirs();
93
 
93
 
94
 		for (Map.Entry<String, byte[]> classEntry : classes.entrySet()) {
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
 			try (FileOutputStream outputStream = new FileOutputStream(output)) {
100
 			try (FileOutputStream outputStream = new FileOutputStream(output)) {
97
 				outputStream.write(classEntry.getValue());
101
 				outputStream.write(classEntry.getValue());
98
 			} catch (IOException ex) {
102
 			} catch (IOException ex) {

Loading…
Cancel
Save