Browse Source

Ignore directories in checking for out of date elements in a Zip/Jar task.

Directories can't really be out of date since they have no content.

PR:	21245


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274777 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 22 years ago
parent
commit
6c0b17e148
1 changed files with 10 additions and 10 deletions
  1. +10
    -10
      src/main/org/apache/tools/ant/util/ResourceUtils.java

+ 10
- 10
src/main/org/apache/tools/ant/util/ResourceUtils.java View File

@@ -105,34 +105,34 @@ public class ResourceUtils {
Vector vresult = new Vector(); Vector vresult = new Vector();
for (int counter = 0; counter < source.length; counter++) { for (int counter = 0; counter < source.length; counter++) {
if (source[counter].getLastModified() > now) { if (source[counter].getLastModified() > now) {
logTo.log("Warning: " + source[counter].getName()
+ " modified in the future.",
logTo.log("Warning: " + source[counter].getName()
+ " modified in the future.",
Project.MSG_WARN); Project.MSG_WARN);
} }


String[] targetnames =
String[] targetnames =
mapper.mapFileName(source[counter].getName() mapper.mapFileName(source[counter].getName()
.replace('/', File.separatorChar)); .replace('/', File.separatorChar));
if (targetnames != null) { if (targetnames != null) {
boolean added = false; boolean added = false;
StringBuffer targetList = new StringBuffer(); StringBuffer targetList = new StringBuffer();
for (int ctarget = 0; !added && ctarget < targetnames.length;
for (int ctarget = 0; !added && ctarget < targetnames.length;
ctarget++) { ctarget++) {
Resource atarget =
Resource atarget =
targets.getResource(targetnames[ctarget] targets.getResource(targetnames[ctarget]
.replace(File.separatorChar, '/')); .replace(File.separatorChar, '/'));
// if the target does not exist, or exists and // if the target does not exist, or exists and
// is older than the source, then we want to // is older than the source, then we want to
// add the resource to what needs to be copied // add the resource to what needs to be copied
if (!atarget.isExists()) { if (!atarget.isExists()) {
logTo.log(source[counter].getName() + " added as "
logTo.log(source[counter].getName() + " added as "
+ atarget.getName() + atarget.getName()
+ " doesn\'t exist.", Project.MSG_VERBOSE); + " doesn\'t exist.", Project.MSG_VERBOSE);
vresult.addElement(source[counter]); vresult.addElement(source[counter]);
added = true; added = true;
} else if (atarget.getLastModified()
} else if (!atarget.isDirectory() && atarget.getLastModified()
< source[counter].getLastModified()) { < source[counter].getLastModified()) {
logTo.log(source[counter].getName() + " added as "
logTo.log(source[counter].getName() + " added as "
+ atarget.getName() + atarget.getName()
+ " is outdated.", Project.MSG_VERBOSE); + " is outdated.", Project.MSG_VERBOSE);
vresult.addElement(source[counter]); vresult.addElement(source[counter]);
@@ -146,13 +146,13 @@ public class ResourceUtils {
} }


if (!added) { if (!added) {
logTo.log(source[counter].getName()
logTo.log(source[counter].getName()
+ " omitted as " + targetList.toString() + " omitted as " + targetList.toString()
+ (targetnames.length == 1 ? " is" : " are ") + (targetnames.length == 1 ? " is" : " are ")
+ " up to date.", Project.MSG_VERBOSE); + " up to date.", Project.MSG_VERBOSE);
} }
} else { } else {
logTo.log(source[counter].getName()
logTo.log(source[counter].getName()
+ " skipped - don\'t know how to handle it", + " skipped - don\'t know how to handle it",
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
} }


Loading…
Cancel
Save