private void resolveFiles(File dir, FileFilter filter, boolean recursive, String path, Map<String, File> files, boolean flatten) { if (Analyzer.doNotCopy.matcher(dir.getName()).matches()) { return; } File[] fs = dir.listFiles(filter); for (File file : fs) { if (file.isDirectory()) { if (recursive) { String nextPath; if ( flatten ) nextPath = path; else nextPath = appendPath( path, file.getName()); resolveFiles(file, filter, recursive, nextPath, files, flatten); } // Directories are ignored otherwise } else { String p =appendPath(path, file.getName()); if ( files.containsKey(p)) warning("Include-Resource overwrites entry %s from file %s", p, file); files.put(p, file); } } }
private void resolveFiles(File dir, FileFilter filter, boolean recursive, String path, Map<String, File> files, boolean flatten) { if (doNotCopy(dir.getName())) { return; } File[] fs = dir.listFiles(filter); for (File file : fs) { if (file.isDirectory()) { if (recursive) { String nextPath; if (flatten) nextPath = path; else nextPath = appendPath(path, file.getName()); resolveFiles(file, filter, recursive, nextPath, files, flatten); } // Directories are ignored otherwise } else { String p = appendPath(path, file.getName()); if (files.containsKey(p)) warning("Include-Resource overwrites entry %s from file %s", p, file); files.put(p, file); } } }
private void copy(Jar jar, String path, File from, boolean preprocess, Map<String, String> extra) throws Exception { if (doNotCopy.matcher(from.getName()).matches()) 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); } else { error("Input file does not exist: " + from); } } }
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); } } }