bodewig 00/07/21 02:43:15
Modified: src/main/org/apache/tools/ant/taskdefs XSLTProcess.java
Log:
Ensure the target file's parent directory exists.
Submitted by: Russell Gold <[EMAIL PROTECTED]>
Revision Changes Path
1.6 +11 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
Index: XSLTProcess.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSLTProcess.java 2000/07/06 16:48:19 1.5
+++ XSLTProcess.java 2000/07/21 09:43:15 1.6
@@ -83,7 +83,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Keith Visco</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sam Ruby</a>
- * @version $Revision: 1.5 $ $Date: 2000/07/06 16:48:19 $
+ * @version $Revision: 1.6 $ $Date: 2000/07/21 09:43:15 $
*/
public class XSLTProcess extends MatchingTask {
@@ -295,6 +295,7 @@
inFile = new File(baseDir,xmlFile);
outFile = new
File(destDir,xmlFile.substring(0,xmlFile.lastIndexOf('.'))+fileExt);
if (inFile.lastModified() > outFile.lastModified()) {
+ ensureDirectoryFor( outFile );
//-- command line status
log("Processing " + xmlFile + " to " + outFile,
Project.MSG_VERBOSE);
@@ -311,4 +312,13 @@
} //-- processXML
+ private void ensureDirectoryFor( File targetFile ) throws BuildException
{
+ File directory = new File( targetFile.getParent() );
+ if (!directory.exists()) {
+ if (!directory.mkdirs()) {
+ throw new BuildException("Unable to create directory: "
+ + directory.getAbsolutePath() );
+ }
+ }
+ }
} //-- XSLTProcess