Author: musachy
Date: Wed Mar 4 20:31:56 2009
New Revision: 750143
URL: http://svn.apache.org/viewvc?rev=750143&view=rev
Log:
Create output directory when it does not exist
Modified:
struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java
Modified:
struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java
URL:
http://svn.apache.org/viewvc/struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java?rev=750143&r1=750142&r2=750143&view=diff
==============================================================================
---
struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java
(original)
+++
struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java
Wed Mar 4 20:31:56 2009
@@ -353,9 +353,15 @@
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ //create output directory if it does not exists
+ File outputFile = new File(getOption("outFile"));
+ File parentDir = outputFile.getParentFile();
+ if (!parentDir.exists())
+ parentDir.mkdirs();
+
Source source = new DOMSource(document);
Result result = new StreamResult(new OutputStreamWriter(
- new FileOutputStream(getOption("outFile"))));
+ new FileOutputStream(outputFile)));
transformer.transform(source, result);
} catch (Exception e) {
// oops we cannot throw checked exceptions