Roger Browne wrote:
There are parrot opcodes for things like opening and reading a file, and PMCs for things like random numbers, environment variables, timers etc. But (unless I've missed something) there is not yet anything that lets me (from PIR) read a directory and get a list of the files within that directory, or get the subdirectories of that directory.
No: you arent't missing anything; yes: parrot can't deal with directories yet.
What's the best way to access functionality like that? Should I write a PMC that behaves like Ruby's pathname class? Or should I use NCI to access some C stuff?
There is a TODO ticket #35391 and there was some discussion on the list but not a real plan or specification, how to deal with directory manipulation.
I can imagine that the namespace of a subclass of ParrotIO can hold the necessary API interfaces and methods. A distinct class is ok too - whatever is a most commonly used pattern in HLLs.
Proposals are welcome.
Regards,
leo
