/** * @param file * @param parent * @param done * @param overwrite * @throws FileNotFoundException * @throws IOException */ public void doIncludeFile(File file, boolean overwrite, Properties target) throws Exception { if (included != null && included.contains(file)) { error("Cyclic or multiple include of " + file); } else { addIncluded(file); updateModified(file.lastModified(), file.toString()); InputStream in = new FileInputStream(file); Properties sub; if (file.getName().toLowerCase().endsWith(".mf")) { sub = getManifestAsProperties(in); } else sub = loadProperties(in, file.getAbsolutePath()); in.close(); doIncludes(file.getParentFile(), sub); // make sure we do not override properties for (Map.Entry<?, ?> entry : sub.entrySet()) { if (overwrite || !target.containsKey(entry.getKey())) target.setProperty((String) entry.getKey(), (String) entry.getValue()); } } }
Properties sub; if (file.getName().toLowerCase().endsWith(".mf")) { sub = getManifestAsProperties(in); } else sub = loadProperties(in, file.getAbsolutePath());