bodewig 01/09/26 00:04:47
Modified: . Tag: ANT_14_BRANCH WHATSNEW
src/main/org/apache/tools/ant/taskdefs Tag: ANT_14_BRANCH
Zip.java
Log:
<zipfileset> would ignore the fullpath attribute when using the src
attribute at the same time.
Submitted by: Simone Bordet <[EMAIL PROTECTED]>
Revision Changes Path
No revision
No revision
1.144.2.12 +3 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.144.2.11
retrieving revision 1.144.2.12
diff -u -r1.144.2.11 -r1.144.2.12
--- WHATSNEW 2001/09/19 12:07:53 1.144.2.11
+++ WHATSNEW 2001/09/26 07:04:47 1.144.2.12
@@ -7,6 +7,9 @@
* <ant>'s antfile attribute will now also be considered an absolute path on
Windows systems, if it starts with a \ and no drive specifier.
+* The fullpath attribute of <zipfileset> has been ignored if you used
+ the src attribute at the same time.
+
Other changes:
--------------
No revision
No revision
1.47.2.1 +15 -6
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
Index: Zip.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
retrieving revision 1.47
retrieving revision 1.47.2.1
diff -u -r1.47 -r1.47.2.1
--- Zip.java 2001/08/03 14:15:40 1.47
+++ Zip.java 2001/09/26 07:04:47 1.47.2.1
@@ -397,9 +397,12 @@
}
protected void addZipEntries(ZipFileSet fs, DirectoryScanner ds,
- ZipOutputStream zOut, String prefix)
+ ZipOutputStream zOut, String prefix, String
fullpath)
throws IOException
{
+ if (prefix.length() > 0 && fullpath.length() > 0)
+ throw new BuildException("Both prefix and fullpath attributes
may not be set on the same fileset.");
+
ZipScanner zipScanner = (ZipScanner) ds;
File zipSrc = fs.getSrc();
@@ -413,9 +416,14 @@
entry = new ZipEntry(origEntry);
String vPath = entry.getName();
if (zipScanner.match(vPath)) {
- addParentDirs(null, vPath, zOut, prefix);
- if (! entry.isDirectory()) {
- zipFile(in, zOut, prefix+vPath, entry.getTime());
+ if (fullpath.length() > 0) {
+ addParentDirs(null, fullpath, zOut, "");
+ zipFile(in, zOut, fullpath, entry.getTime());
+ } else {
+ addParentDirs(null, vPath, zOut, prefix);
+ if (! entry.isDirectory()) {
+ zipFile(in, zOut, prefix+vPath, entry.getTime());
+ }
}
}
}
@@ -679,7 +687,8 @@
/**
* Iterate over the given Vector of (zip)filesets and add
- * all files to the ZipOutputStream using the given prefix.
+ * all files to the ZipOutputStream using the given prefix
+ * or fullpath.
*/
protected void addFiles(Vector filesets, ZipOutputStream zOut)
throws IOException {
@@ -713,7 +722,7 @@
if (fs instanceof ZipFileSet
&& ((ZipFileSet) fs).getSrc() != null) {
- addZipEntries((ZipFileSet) fs, ds, zOut, prefix);
+ addZipEntries((ZipFileSet) fs, ds, zOut, prefix, fullpath);
} else {
// Add the fileset.
addFiles(ds, zOut, prefix, fullpath);