System.FilePath propsal (Was: Cabal feedback notes)
ka2_mail at yahoo.com
Wed Oct 27 03:47:24 EDT 2004
--- Andrew Pimlott <andrew at pimlott.net> wrote:
> On Tue, Oct 26, 2004 at 11:43:40AM -0700, Krasimir
> Angelov wrote:
> > --- Andrew Pimlott <andrew at pimlott.net> wrote:
> > > You don't seem to address the problem of volumes
> > > drives (a:, c:). I don't think you can punt
> > The drives are handled implicitly. They are always
> > part of directory name.
> Well, for example you couldn't write a file picker
> with this API,
> because you can't ask for all the roots. Maybe
> that's enough, because
> pathInits can be used to find the root for a given
> file (the first
> element of pathInits being the root).
The pathInits isn't suitable in this case. It is
useful in case if you want to create some file but you
are not sure wheter all directories in the path are
created. The pathInits returns a list of all
directories that must must be created.
pathInits "c:" == 
pathInits "c:\\" == 
pathInits "c:\\dir1" == ["c:\\dir1\\"]
pathInits "c:\\dir1\\dir2" == ["c:\\dir1\\",
In the above example c: and c:\ aren't included in the
list because you can't create c:\ as directory. The
getPathRoot function is more appropriate in your case.
getPathRoot "c:\\dir" == "c:\\"
> For example, what should splitFileName "/" (unix) or
> splitFileName "." be,
> and why? I can't think of any answers that are
> consistent with the type
> (FilePath -> (String, String)).
In the current implementation:
splitFileName "/" == ("/", "")
splitFileName "." == (".", ".")
This is consistent in the sense of rules:
"/" `joinFileName` "" == "/"
"." `joinFileName` "." == "."
i.e. the joinFileName is the reverse function of
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.
More information about the Libraries