Create directory if folder has been deleted during runtime

This commit is contained in:
Frank van der Heijden 2021-07-25 00:21:37 +02:00
parent 9c2a0545d6
commit 4ca8651ebd
No known key found for this signature in database
GPG key ID: B808721C2DD5B5B8

View file

@ -62,6 +62,10 @@ public class VelocityPluginCommandManager {
* Saves the map to the {@link Path} it was loaded from. * Saves the map to the {@link Path} it was loaded from.
*/ */
public void save() throws IOException { public void save() throws IOException {
if (Files.notExists(path.getParent())) {
Files.createDirectories(path.getParent());
}
Files.write( Files.write(
path, path,
gson.toJson(pluginCommands.asMap()).getBytes(StandardCharsets.UTF_8), gson.toJson(pluginCommands.asMap()).getBytes(StandardCharsets.UTF_8),