Browse Source

create parent directory of archive in <zip> and <tar> if needed. PR 45377. Based on patch by Remie Bolte

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@807960 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 16 years ago
parent
commit
f2d99c202b
5 changed files with 22 additions and 0 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +4
    -0
      WHATSNEW
  3. +4
    -0
      contributors.xml
  4. +6
    -0
      src/main/org/apache/tools/ant/taskdefs/Tar.java
  5. +7
    -0
      src/main/org/apache/tools/ant/taskdefs/Zip.java

+ 1
- 0
CONTRIBUTORS View File

@@ -252,6 +252,7 @@ Rami Ojares
Randy Watler
Raphael Pierquin
Ray Waldin
Remie Bolte
Richard Evans
Rick Beton
Robert Anderson


+ 4
- 0
WHATSNEW View File

@@ -919,6 +919,10 @@ Other changes:
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
=============================================



+ 4
- 0
contributors.xml View File

@@ -1030,6 +1030,10 @@
<first>Ray</first>
<last>Waldin</last>
</name>
<name>
<first>Remie</first>
<last>Bolte</last>
</name>
<name>
<first>Richard</first>
<last>Evans</last>


+ 6
- 0
src/main/org/apache/tools/ant/taskdefs/Tar.java View File

@@ -279,6 +279,12 @@ public class Tar extends MatchingTask {
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;


+ 7
- 0
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -618,6 +618,13 @@ public class Zip extends MatchingTask {
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);


Loading…
Cancel
Save