/** * Sets the path to the working directory for the file system. The working directory must be an * absolute path starting with one of the configured roots. * * @throws InvalidPathException if the given path is not valid for this builder's path type * @throws IllegalArgumentException if the given path is valid for this builder's path type but * is not an absolute path */ public Builder setWorkingDirectory(String workingDirectory) { PathType.ParseResult parseResult = pathType.parsePath(workingDirectory); checkArgument( parseResult.isAbsolute(), "working directory must be an absolute path: %s", workingDirectory); this.workingDirectory = checkNotNull(workingDirectory); return this; }
/** * Sets the roots for the file system. * * @throws InvalidPathException if any of the given roots is not a valid path for this builder's * path type * @throws IllegalArgumentException if any of the given roots is a valid path for this builder's * path type but is not a root path with no name elements */ public Builder setRoots(String first, String... more) { List<String> roots = Lists.asList(first, more); for (String root : roots) { PathType.ParseResult parseResult = pathType.parsePath(root); checkArgument(parseResult.isRoot(), "invalid root: %s", root); } this.roots = ImmutableSet.copyOf(roots); return this; }