/** * Return the VFS object represented by the given {@code rowPath}. * * @param rawPath * @return {@code null} if the object does not exist in the VFS */ public FSObject findFSObject(String rawPath) { String path = new File(rawPath).getAbsolutePath(); String[] tokens = tokenize(path); markAccessedFile(path); VFolder parent = root; for (int i = 0; i < tokens.length; i++) { String name = tokens[i]; FSObject child = parent.getChild(name); // child might not exist if (child == null || child.isDeleted()) { return null; } // we might end up with a file on the path that is not a folder if (i < (tokens.length - 1) && !child.isFolder()) { return null; } else { if (i == (tokens.length - 1)) { return child; } } parent = (VFolder) child; } return parent; }