Ejemplo n.º 1
0
 private static final class UnixHolder {
   private static final Configuration UNIX =
       Configuration.builder(PathType.unix())
           .setRoots("/")
           .setWorkingDirectory("/work")
           .setAttributeViews("basic")
           .setSupportedFeatures(LINKS, SYMBOLIC_LINKS, SECURE_DIRECTORY_STREAM, FILE_CHANNEL)
           .build();
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }
Ejemplo n.º 3
0
 /**
  * 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;
 }
Ejemplo n.º 4
0
 private static final class WindowsHolder {
   private static final Configuration WINDOWS =
       Configuration.builder(PathType.windows())
           .setRoots("C:\\")
           .setWorkingDirectory("C:\\work")
           .setNameCanonicalNormalization(CASE_FOLD_ASCII)
           .setPathEqualityUsesCanonicalForm(true) // matches real behavior of WindowsPath
           .setAttributeViews("basic")
           .setSupportedFeatures(LINKS, SYMBOLIC_LINKS, FILE_CHANNEL)
           .build();
 }