System.Directory.getDirectoryContents functionality on empty String
Hello,
It seems to me that getDirectoryContents should return the contents of the current directory when passed an empty string, like so:
getDirectoryContents :: FilePath -> IO [FilePath] getDirectoryContents "" = getCurrentDirectory >>= getDirectoryContents getDirectoryContents path = do -- ...etc.
- ..this would enable the function to work more easily with the
functions in System.FilePath for example:
getDirectoryContents (dropFileName "directory/file") == OK getDirectoryContents (dropFileName "file") == FAIL
getDirectoryContents (dropFileName "./") == OK getDirectoryContents (dropFileName ".") == FAIL
- ..it also seems like the expected functionality, mirroring the 'ls'
command on *nix, etc.
Are there any cases/OSes where trying to open a file named "" wouldn't fail? Any other reasons why this is a bad idea?
Thanks, Brandon
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.8.2 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |