public DirectoryEntry getDirEntry()

in taverna-server-webapp/src/main/java/org/apache/taverna/server/master/utils/FilenameUtils.java [99:121]


	public DirectoryEntry getDirEntry(TavernaRun run, List<PathSegment> d)
			throws FilesystemAccessException, NoDirectoryEntryException {
		Directory dir = run.getWorkingDirectory();
		if (d == null || d.isEmpty())
			return dir;
		DirectoryEntry found = dir;
		boolean mustBeLast = false;

		// Must be nested loops; avoids problems with %-encoded "/" chars
		for (PathSegment segment : d)
			for (String bit : segment.getPath().split("/")) {
				if (mustBeLast)
					throw new FilesystemAccessException(TYPE_ERROR);
				found = getEntryFromDir(bit, dir);
				dir = null;
				if (found instanceof Directory) {
					dir = (Directory) found;
					mustBeLast = false;
				} else
					mustBeLast = true;
			}
		return found;
	}