if (entry.startsWith("/")) {
// Entry is a relative path, must not start with a '/', fix it.
entry = entry.substring(1);
}
FileSet fileSet = null;
File src= new File(dir, entry);
// Bundle class path entries are either directories or jar/zip-files!
if (src.isDirectory()) {
fileSet = new FileSet();
fileSet.setDir(src);
fileSet.setProject(getProject());
} else if (src.exists()) {
fileSet = new ZipFileSet();
((ZipFileSet) fileSet).setSrc(src);
} else {
final StringBuffer msg = new StringBuffer();
msg.append("The following entry in the Bundle-ClassPath")
.append(" header doesn't exist in the bundle: ")
.append(entry)
.append(".");
if (failOnClassPath) {
log(msg.toString(), Project.MSG_ERR);
throw new BuildException(msg.toString(), getLocation());
} else {
log(msg.toString(), Project.MSG_WARN);
continue;
}
}
fileSet.setProject(proj);
if (null!=includes) {
fileSet.setIncludes(includes);
}
if (null!=excludes) {
fileSet.setExcludes(excludes);
}
res.add(fileSet);
log("Added FileSet with root '" +src +"', includes: '" +includes
+"', excludes: '" +excludes +"'.", Project.MSG_DEBUG);
}