ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs XSLTProcess.java
Date Fri, 21 Jul 2000 09:43:16 GMT
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 <russgold@acm.org>
  
  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:kvisco@exoffice.com">Keith Visco</a>
    * @author <a href="mailto:rubys@us.ibm.com">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
  
  
  

Mime
View raw message