Skip to content

Commit a0f343e

Browse files
committed
honor filter argument in VFS.newDirectoryStream
1 parent b3756e2 commit a0f343e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

graalpython/org.graalvm.python.embedding/src/org/graalvm/python/embedding/utils/VirtualFileSystem.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,16 @@ public void close() throws IOException {
834834

835835
@Override
836836
public Iterator<Path> iterator() {
837-
return dirEntry.entries.stream().map(e -> Path.of(e.getPlatformPath())).iterator();
837+
return dirEntry.entries.stream().filter(e -> {
838+
boolean accept = false;
839+
try {
840+
accept = filter.accept(Path.of(e.platformPath));
841+
} catch (IOException ex) {
842+
ex.printStackTrace();
843+
return false;
844+
}
845+
return accept;
846+
}).map(e -> Path.of(e.getPlatformPath())).iterator();
838847
}
839848
};
840849
} else {

0 commit comments

Comments
 (0)