[GHC] #3203: System.Directory.getDirectoryContents
functionality on empty String
GHC
trac at galois.com
Wed Apr 29 18:37:55 EDT 2009
#3203: System.Directory.getDirectoryContents functionality on empty String
------------------------------+---------------------------------------------
Reporter: jberryman | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 6.8.2
Severity: normal | Resolution:
Keywords: System.Directory | Testcase:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
------------------------------+---------------------------------------------
Comment (by jberryman):
christ... let's try that again:
{{{
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 where trying to open a file named "" wouldn't
fail? Any other reasons
why this is a bad idea?
Thanks,
Brandon
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3203#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list