Updated the .schematic save routine to also create directories as required.

This commit is contained in:
sk89q 2010-10-04 17:04:28 -07:00
parent 414c3cf33d
commit 48aeb58bbb

View File

@ -501,6 +501,12 @@ public class WorldEdit extends Plugin {
if (!filePath.substring(0, dirPath.length()).equals(dirPath)) { if (!filePath.substring(0, dirPath.length()).equals(dirPath)) {
player.sendMessage(Colors.Rose + "Invalid path for Schematic."); player.sendMessage(Colors.Rose + "Invalid path for Schematic.");
} else { } else {
// Create parent directories
File parent = f.getParentFile();
if (parent != null && !parent.exists()) {
parent.mkdirs();
}
session.getClipboard().saveSchematic(filePath); session.getClipboard().saveSchematic(filePath);
logger.log(Level.INFO, player.getName() + " saved " + filePath); logger.log(Level.INFO, player.getName() + " saved " + filePath);
player.sendMessage(Colors.LightPurple + filename + " saved."); player.sendMessage(Colors.LightPurple + filename + " saved.");