Change FileSystem#getDirectoryEntries to return strings of the file/directory names instead of paths.
This is a small isolated change that can be done ahead of the big refactoring.
PiperOrigin-RevId: 173124518
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/Path.java b/src/main/java/com/google/devtools/build/lib/vfs/Path.java
index b5eabcf..81b7ac0 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/Path.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/Path.java
@@ -33,6 +33,7 @@
import java.lang.ref.WeakReference;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.IdentityHashMap;
import java.util.Objects;
@@ -514,7 +515,12 @@
* @throws IOException If the path does not denote a directory
*/
public Collection<Path> getDirectoryEntries() throws IOException, FileNotFoundException {
- return fileSystem.getDirectoryEntries(this);
+ Collection<String> entries = fileSystem.getDirectoryEntries(this);
+ Collection<Path> result = new ArrayList<>(entries.size());
+ for (String entry : entries) {
+ result.add(getChild(entry));
+ }
+ return result;
}
/**