aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/vfs/Root.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs/Root.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/Root.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/Root.java b/src/main/java/com/google/devtools/build/lib/vfs/Root.java
index c7c78900f8..454e9b26a2 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/Root.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/Root.java
@@ -40,6 +40,12 @@ public abstract class Root implements Comparable<Root>, Serializable {
return fileSystem.getAbsoluteRoot();
}
+ public static Root toFileSystem(Root root, FileSystem fileSystem) {
+ return root.isAbsolute()
+ ? new AbsoluteRoot(fileSystem)
+ : new PathRoot(fileSystem.getPath(root.asPath().asFragment()));
+ }
+
/** Returns a path by concatenating the root and the root-relative path. */
public abstract Path getRelative(PathFragment rootRelativePath);