Skip to content

Commit 2a8e32e

Browse files
JsonIO: mkdirs
1 parent 8f62bc1 commit 2a8e32e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/main/java/dev/latvian/mods/kubejs/util/JsonIO.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public static void write(Path path, @Nullable JsonElement json) throws IOExcepti
7171
if (json == null || json instanceof JsonNull) {
7272
Files.deleteIfExists(path);
7373
} else {
74+
if (Files.notExists(path.getParent())) {
75+
Files.createDirectories(path.getParent());
76+
}
7477
Files.writeString(path, JsonUtils.toPrettyString(json));
7578
}
7679
}

0 commit comments

Comments
 (0)