|
Boost : |
From: Stewart, Robert (stewart_at_[hidden])
Date: 2002-03-07 16:09:32
From: Jan Langer [mailto:jan_at_[hidden]]
>
> >> 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.
>
> i don't understand you here. you want no directory_iterators?
What you've suggested is that the library magically determined that "A:\"
was the directory of choice (or "/bin" for Posix). I would not want that.
On the one hand, root_directory() suggests "/" to me for Posix. On the
other, there is no "root directory" concept on DOS-style filesystems apart
from that of the current drive. Therefore, the behavior you described
suggests that root_directory() either relied on the current directory to
determine the current drive, thus selecting "A:\" if the current directory
referred to some directory on drive A, or that root_directory() determined a
priori which drive's root directory it will return. Both seem too "magical"
to me.
The proposed idea that root_directory() returns a set of available drives
helps, but I doubt code calling erase() as you've shown above really wants
to iterate all available drives to delete all files from each. (That would
make for a simple virus, though!)
Rob
Susquehanna International Group, LLP
http://www.sig.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk