You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by um...@apache.org on 2001/12/27 22:47:17 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Mkdir.java
umagesh 01/12/27 13:47:17
Modified: src/main/org/apache/tools/ant/taskdefs Mkdir.java
Log:
Delegate validation to DestDir. This has a nice effect on MkDir as at least
one 'unknown reason' (Path containing an existing non-directory element) will
be known by using DestDir.
Revision Changes Path
1.11 +16 -7 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Mkdir.java
Index: Mkdir.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Mkdir.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Mkdir.java 2001/11/27 18:04:52 1.10
+++ Mkdir.java 2001/12/27 21:47:17 1.11
@@ -54,9 +54,10 @@
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.BuildException;
import java.io.File;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.DestDir;
/**
@@ -74,10 +75,6 @@
throw new BuildException("dir attribute is required", location);
}
- 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 = dir.mkdirs();
if (result == false) {
@@ -89,7 +86,19 @@
}
}
+ /**
+ * @deprecated setDir(File) is deprecated and is replaced with
+ * setDir(DestDir) to let Ant's core perform validation
+ */
public void setDir(File dir) {
- this.dir = dir;
+ log("DEPRECATED - The setDir(File) method has been deprecated."
+ + " Use setDir(DestDir) instead.");
+ DestDir destDir = new DestDir();
+ destDir.setFile(dir);
+ setDir(destDir);
+ }
+
+ public void setDir(DestDir destDir) {
+ this.dir = destDir.getFile();
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>