Create the directories for generated files if necessary

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6147 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Charlie Groves
2010-09-07 23:45:04 +00:00
parent d35526a3c4
commit be64ef83f1
@@ -411,7 +411,11 @@ public abstract class InvocationTask extends GenTask
if (_header != null) {
data = _header + data;
}
new PrintWriter(new File(path), "UTF-8").append(data).close();
File dest = new File(path);
if (!dest.getParentFile().exists() && !dest.getParentFile().mkdirs()) {
throw new BuildException("Unable to create directory for " + dest.getAbsolutePath());
}
new PrintWriter(dest, "UTF-8").append(data).close();
}
protected static <T> void checkedAdd (List<T> list, T value)