Commit Graph

3 Commits

Author SHA1 Message Date
Stiopa Koltsov
4eff6ac916 System.Directory.listDir
This function is what users want 99.9% of time.
2021-07-17 14:58:57 +01:00
Stiopa Koltsov
c7629e20fe Skip dot and dot-dot in nextDirEntry
These entries returned by `readdir` are legacy of Unix API, we don't
really need them. Most APIs do not return them (for example Java
`Files.newDirectoryStream` or Python `os.listdir`).
2021-07-17 14:58:28 +01:00
Stiopa Koltsov
0ecf74e434 System.Directory.nextDirEntry
* add `nextDirEntry` which returns `Maybe String`, so `Nothing` on
  the end of directory unlike `dirEntry` which returns unspecified error
  on the end of directory
* `dirEntry` is deprecated now, but not removed because compiler depends on it
* native implementation of `dirEntry` is patched to explicitly reset `errno`
  before the `readdir` call: without it end of directory and error were
  indistinguishable
* test added
2021-07-17 14:57:27 +01:00