From: Stewart, Robert (stewart_at_[hidden])
Date: 2002-03-06 09:42:48
From: Jan Langer [mailto:jan_at_[hidden]]
> On Tue, 5 Mar 2002, Beman Dawes wrote:
> > > eg. if i want to write
> > >something to the root directory. it would not be allowed
> on win32. but
> > >if i call directory_iterator (root_directory ()) it fits for win32
> > >("c:") but not for posix ("/bin").
> > >a hierarchy_iterator however returns "/" on posix and "c:"
> on win32.
> >I was assuming directory_iterator( root_directory() ) would
> return all the
> >directory_entry's in "/" for POSIX, and a:,b:,c:, etc for win32.
> yes, but this is not what most users would expect. i think posix's '/'
> corresponds to win's 'c:' and posix's '/bin' corresponds to wins
> 'c:\Windows\'. of course i mean only the level in the hierarchy.
You can't assume which directory makes sense for root_directory(). If a PC
is booted from a floppy, then "A:\" may be correct. If a system is
configured to do its initial boot from one device and then switches to
another, then the root directory of some other drive is the correct value
for root_directory() to return. Consequently, I think that this concept
must be handled separately.
What I mean is that on a drive letter-based filesystem, one must determine
the correct drive letter by some extra-library or otherwise
filesystem-dependent means. Once you have the correct drive letter, perhaps
including the : and \, then the rest of the library under discussion comes
The point is that you can't coerce such wildly diverse concepts into a
single function and get meaningful cross-platform behavior. If I am a Unix
developer and I called root_directory(), I'd expect a single value, just as
I had always gotten from it. If I found myself calling root_directory() on
a PC-based filesystem, imagine my surprise to learn that I got back some
sort of list of things rather than the one I had always gotten before.
> if i call erase (*directory_iterator (root_directory ())) i
> expect that
> on posix it tries to delete /bin and on windows
> a:/firstfileonfloppy.txt. this behaviour can be achieved by a
> hierarchy_iterator in a much clearer way.
I would never want the library to do the kind of magic I think you're
suggesting here. If I want to delete a:\firstfileonfloppy.txt, then I want
to be the one to create that pathname...explicitly.
Susquehanna International Group, LLP
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk