/** * Set the File for this FileResource. * @param f the File to be represented. */ public void setFile(File f) { checkAttributesAllowed(); file = f; if (f != null && (getBaseDir() == null || !FILE_UTILS.isLeadingPath(getBaseDir(), f))) { setBaseDir(f.getParentFile()); } }
/** * Create a new resource that matches a relative or absolute path. * If the current instance has a compatible baseDir attribute, it is copied. * @param path relative/absolute path to a resource * @return a new resource of type FileResource * @throws BuildException if desired * @since Ant1.8 */ @Override public Resource getResource(String path) { File newfile = FILE_UTILS.resolveFile(getFile(), path); FileResource fileResource = new FileResource(newfile); if (FILE_UTILS.isLeadingPath(getBaseDir(), newfile)) { fileResource.setBaseDir(getBaseDir()); } return fileResource; }