create the directory and all parents
if (dir == null) {
throw new BuildException("dir attribute is required", getLocation());
}
if (dir.isFile()) {
throw new BuildException("Unable to create directory as a file "
+ "already exists with that name: "
+ dir.getAbsolutePath());
}
if (!dir.exists()) {
boolean result = mkdirs(dir);
if (!result) {
String msg = "Directory " + dir.getAbsolutePath()
+ " creation was not successful for an unknown reason";
throw new BuildException(msg, getLocation());
}
log("Created dir: " + dir.getAbsolutePath());
} else {
log("Skipping " + dir.getAbsolutePath()
+ " because it already exists.", Project.MSG_VERBOSE);
}