private void copy(Jar jar, String path, File from, boolean preprocess, Map<String, String> extra)
throws Exception {
if (doNotCopy(from.getName()))
return;
if (from.isDirectory()) {
File files[] = from.listFiles();
for (int i = 0; i < files.length; i++) {
copy(jar, appendPath(path, files[i].getName()), files[i], preprocess, extra);
}
} else {
if (from.exists()) {
Resource resource = new FileResource(from);
if (preprocess) {
resource = new PreprocessResource(this, resource);
}
String x = extra.get("extra");
if (x != null)
resource.setExtra(x);
if (path.endsWith("/"))
path = path + from.getName();
jar.putResource(path, resource);
if (isTrue(extra.get(LIB_DIRECTIVE))) {
setProperty(BUNDLE_CLASSPATH, append(getProperty(BUNDLE_CLASSPATH), path));
}
} else {
error("Input file does not exist: " + from);
}
}
}