Using Kawa 1.14.
I have tried opening the directory as a file (because file-exists? reports #t), and using read-line to read the "contents", but it does not work. I get an "Access denied" error.
At the Java level, there are two ways to list directories. You can use File.list
or File.listFiles
, or you can use Files.newDirectoryStream
.
At the Kawa level, having briefly grepped through the source, it doesn't seem to use any of those interfaces. So it doesn't look like there's a built-in way to list directories in Kawa. You would need to use Kawa's Java method invocation features to invoke one of the above interfaces.
Looking through the source, I found kawa\lib\files.scm, which defines directory-files.
So, it is just a matter of: