Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 68701 invoked by uid 500); 21 Jul 2000 09:43:17 -0000 Delivered-To: apmail-jakarta-ant-cvs@apache.org Received: (qmail 68698 invoked by uid 1146); 21 Jul 2000 09:43:16 -0000 Date: 21 Jul 2000 09:43:16 -0000 Message-ID: <20000721094316.68693.qmail@locus.apache.org> From: bodewig@locus.apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs XSLTProcess.java 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 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 Keith Visco * @author Sam Ruby - * @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