Author: bodewig Date: Wed Aug 26 11:03:10 2009 New Revision: 807960 URL: http://svn.apache.org/viewvc?rev=807960&view=rev Log: create parent directory of archive in <zip> and <tar> if needed. PR 45377. Based on patch by Remie Bolte
Modified: ant/core/trunk/CONTRIBUTORS ant/core/trunk/WHATSNEW ant/core/trunk/contributors.xml ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java Modified: ant/core/trunk/CONTRIBUTORS URL: http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=807960&r1=807959&r2=807960&view=diff ============================================================================== Binary files - no diff available. Modified: ant/core/trunk/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=807960&r1=807959&r2=807960&view=diff ============================================================================== --- ant/core/trunk/WHATSNEW (original) +++ ant/core/trunk/WHATSNEW Wed Aug 26 11:03:10 2009 @@ -919,6 +919,10 @@ HTTP connections at the HttpUrlConnection level. Bugzilla Report 41891. + * <tar> and <zip> (and tasks derived from <zip>) will now create the + parent directory of the destination archive if it doesn't exist. + Bugzilla Report 45377. + Changes from Ant 1.7.0 TO Ant 1.7.1 ============================================= Modified: ant/core/trunk/contributors.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=807960&r1=807959&r2=807960&view=diff ============================================================================== --- ant/core/trunk/contributors.xml (original) +++ ant/core/trunk/contributors.xml Wed Aug 26 11:03:10 2009 @@ -1031,6 +1031,10 @@ <last>Waldin</last> </name> <name> + <first>Remie</first> + <last>Bolte</last> + </name> + <name> <first>Richard</first> <last>Evans</last> </name> Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java?rev=807960&r1=807959&r2=807960&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java Wed Aug 26 11:03:10 2009 @@ -279,6 +279,12 @@ return; } + File parent = tarFile.getParentFile(); + if (parent != null && !parent.isDirectory() && !parent.mkdirs()) { + throw new BuildException("Failed to create missing parent" + + " directory for " + tarFile); + } + log("Building tar: " + tarFile.getAbsolutePath(), Project.MSG_INFO); TarOutputStream tOut = null; Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java?rev=807960&r1=807959&r2=807960&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java Wed Aug 26 11:03:10 2009 @@ -618,6 +618,13 @@ if (!state.isOutOfDate()) { return; } + + File parent = zipFile.getParentFile(); + if (parent != null && !parent.isDirectory() && !parent.mkdirs()) { + throw new BuildException("Failed to create missing parent" + + " directory for " + zipFile); + } + updatedFile = true; if (!zipFile.exists() && state.isWithoutAnyResources()) { createEmptyZip(zipFile);