"Only FileSystem resources are supported.");
}
Iterator resources = rc.iterator();
while (resources.hasNext()) {
Resource r = (Resource) resources.next();
if (!r.isExists()) {
String message = "Warning: Could not find resource "
+ r.toLongString() + " to copy.";
if (!failonerror) {
log(message, Project.MSG_ERR);
} else {
throw new BuildException(message);
}
continue;
}
File baseDir = NULL_FILE_PLACEHOLDER;
String name = r.getName();
FileProvider fp = (FileProvider) r.as(FileProvider.class);
if (fp != null) {
FileResource fr = ResourceUtils.asFileResource(fp);
baseDir = getKeyFile(fr.getBaseDir());
if (fr.getBaseDir() == null) {
name = fr.getFile().getAbsolutePath();
}
}
// copying of dirs is trivial and can be done
// for non-file resources as well as for real
// files.
if (r.isDirectory() || fp != null) {
add(baseDir, name,
r.isDirectory() ? dirsByBasedir
: filesByBasedir);
baseDirs.add(baseDir);
} else { // a not-directory file resource
// needs special treatment
nonFileResources.add(r);