22 Jan 15:38
Re: filepath
Simon Marlow <simonmarhaskell <at> gmail.com>
2008-01-22 14:38:59 GMT
2008-01-22 14:38:59 GMT
Neil Mitchell wrote: > Hi Simon > >> I've just come across this again. It's quite inconvenient that >> >> takeDirectory "foo" == "" >> >> because it means that you can't say >> >> doesDirectoryExist (takeDirectory f) > > Yes, I came across this the other day. And am leaning towards agreeing with you. > > I think its reasonable if splitFileName keeps the same behaviour, and > dropFileName as well, but takeDirectory follows the new behaviour. So: > > takeDirectory "foo" = "." > takeDirectory "foo/bar" = "foo" > > dropFileName "foo" = "" > dropFilename "foo/bar" = "foo/" > > Does that sound like a plan that suits everyone? That seems strange, actually. I would expect, perhaps naively, that takeDirectory == fst . splitFileName dropFileName == takeDirectory is there a good reason for these not to be true? Cheers, Simon
RSS Feed