[Haskell-cafe] File path programme

David Roundy droundy at abridgegame.org
Tue Jan 25 06:56:26 EST 2005


On Tue, Jan 25, 2005 at 01:32:29PM +0200, Krasimir Angelov wrote:
> >  splitFileName "/foo/bar" ==> ("/foo","bar")
> >  splitFileName "/foo//bar" ==> ("/foo/","bar")
> >    (definitely a bug)
> 
> Is "/foo//bar" valid file path and what does "//" mean?

"//" means the same thing as "/".  In unix you can use as many directory
separators as you like.  Or alternatively, you could think of it as meaning
the same thing as "/./", which might make more sense.  I suppose you could
think of the directory "" as being equivalent to ".", which would explain
why "./foo" and "foo" are the same thing, as is "././foo" or ".//foo", and
"foo/" and "foo/." are also the same.  The exception of course is that
"/foo" and "./foo" are not the same thing.
-- 
David Roundy
http://www.darcs.net


More information about the Haskell-Cafe mailing list