private Node getDir(Node file) throws IOException { return file.isFile() && (file instanceof FileNode) ? ((FileNode) file).openZip() : file; }
/** @return false for dangling links */ public T checkFile() throws ExistsException, FileNotFoundException { if (isFile()) { return (T) this; } if (exists()) { throw new FileNotFoundException(this, "file not found - this is a directory"); } else { throw new FileNotFoundException(this); } }
if (isManifest(node)) { throw new ArchiveException("manifest file not allowed"); } else if (node.isFile()) { files.add(node); } else {
public ClassDef lookup(String name) throws IOException { ClassDef result; Node file; String path; ClassDef def; def = defs.get(name); if (def != null) { return def; } if (parent != null) { result = parent.lookup(name); if (result != null) { return result; } } path = ClassRef.classToResName(name); for (Node dir : lazy) { file = dir.join(path); if (file.isFile()) { def = Input.load(file); add(def); return def; } } return null; }
public String directory(Node leftdir, Node rightdir, List<String> paths) throws IOException { StringBuilder result; Node left; Node right; result = new StringBuilder(); leftdir.checkDirectory(); rightdir.checkDirectory(); for (String path : paths) { left = leftdir.join(path); right = rightdir.join(path); if (left.isDirectory()) { if (right.isDirectory()) { // ok } else if (right.isFile()) { throw new IOException("TODO"); } else { if (brief) { header('A', path, result); } else { // TODO } } } else if (right.isDirectory()) { header("A", path, result); } else { file(left, right, path, result); } } return result.toString(); }
/** @param passphrase null to try to load passphrase from ~/.ssh/passphrase file */ public void addDefaultIdentity(String passphrase) throws IOException, JSchException { Node dir; Node file; Node key; dir = getWorld().getHome().join(".ssh"); file = dir.join("passphrase"); if (passphrase == null && file.exists()) { passphrase = file.readString().trim(); } key = dir.join("id_dsa"); if (!key.exists()) { key = dir.join("id_rsa"); if (!key.exists()) { key = dir.join("identity"); } } if (!key.isFile()) { throw new IOException("private key not found: " + key); } addIdentity(key, passphrase); }