ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russell Gold <russg...@acm.org>
Subject [PATCH] creating sub-directories for Style task
Date Thu, 20 Jul 2000 15:29:58 GMT
This patch should ensure that the target directories are in place for the 
style task to use:

------ begin patch ----
Index: src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java,v
retrieving revision 1.5
diff -u -r1.5 XSLTProcess.java
--- src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java     2000/07/06 
16:48:19     1.5
+++ src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java     2000/07/20 
15:27:13
@@ -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);

@@ -310,5 +311,14 @@
          }

      } //-- 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
------- end patch -----


Mime
View raw message