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();
for (int counter = 0; counter < source.length; counter++) {
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);
}

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

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


Loading…
Cancel
Save