List of usage examples for com.google.common.jimfs Configuration toBuilder
public Builder toBuilder()
From source file:com.android.repository.testframework.MockFileOp.java
private static FileSystem createFileSystem() { // TODO: use the current platform configuration and get rid of all the agnostic path stuff. Configuration config = Configuration.unix(); config = config.toBuilder().setWorkingDirectory("/").setAttributeViews("posix").build(); return Jimfs.newFileSystem(config); }
From source file:com.facebook.buck.io.filesystem.impl.FakeProjectFilesystem.java
public static ProjectFilesystem createJavaOnlyFilesystem(String rootPath) { boolean isWindows = Platform.detect() == Platform.WINDOWS; Configuration configuration = isWindows ? Configuration.windows() : Configuration.unix(); rootPath = isWindows ? "C:" + rootPath : rootPath; FileSystem vfs = Jimfs.newFileSystem(configuration.toBuilder().setAttributeViews("basic", "posix").build()); Path root = vfs.getPath(rootPath); try {/*from w ww . ja v a 2 s . c om*/ Files.createDirectories(root); } catch (IOException e) { throw new RuntimeException(e); } return new DefaultProjectFilesystem(root, new DefaultProjectFilesystemDelegate(root), DefaultProjectFilesystemFactory.getWindowsFSInstance()) { @Override public Path resolve(Path path) { // Avoid resolving paths from different Java FileSystems. return resolve(path.toString()); } }; }