public boolean hasAncestor(Node ancestor) { T current; current = (T) this; while (true) { if (current.equals(ancestor)) { return true; } current = (T) current.getParent(); if (current == null) { return false; } } }
public boolean hasDifferentAncestor(Node ancestor) { T parent; parent = getParent(); if (parent == null) { return false; } else { return parent.hasAncestor(ancestor); } }
private Node archiveDirectory(Node node) throws MkdirException { return node.getParent().join("archive", FMT.format(LocalDateTime.now())).mkdirsOpt(); } }
/** * Throws an exception if this is not a link. */ public T resolveLink() throws ReadLinkException { String path; path = readLink(); if (path.startsWith(Filesystem.SEPARATOR_STRING)) { return getRoot().node(path.substring(1), null); } else { return (T) getParent().join(path); } }
public T mkdirsOpt() throws MkdirException { T parent; try { if (!isDirectory()) { parent = getParent(); if (parent != null) { parent.mkdirsOpt(); } mkdir(); // fail here if it's a file! } } catch (ExistsException e) { throw new MkdirException(this, e); } return (T)this; }
zip.closeEntry(); } else { node.getParent().mkdirsOpt(); buffer.copy(zip, node); zip.closeEntry();
dest.mkdirsOpt(); } else { dest.getParent().mkdirsOpt(); if (content == null || binary.matches(src.node.getRelative(sourcedir))) { src.node.copyFile(dest);