Boost logo

Boost :

From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2008-07-03 21:31:42


David Abrahams wrote:
> Michael Marcin wrote:
>> Doesn't leaf serve 2 functions? If the path points to a directory it
>> returns most derived directory
>
> It does not return a directory. We don't have a type that can represent
> a directory. We only have paths and strings.
>
>> (to make a bad analogy to class
>> hierarchy). If the path points to a file it returns the filename.
>
> No. In either case it returns the name of the thing that the path
> points to.

Sorry I meant name of a directory or name of a file.

 From the filesystem doc's index page:

"leaf() returns a string which is a copy of the last (closest to the
leaf, farthest from the root) file or directory name in the path object."

I don't believe any of the functions need to touch the filesystem with
the possible exception of parent which could be relaxed to just return
path + "../" since at least on windows if you ../ yourself above the
root of your current drive you just end up at the root of the current drive.

Or do you mean that you can't determine if it is a path to a file
because files can look just like directories if they have no extensions
and directories can contain periods?

That is annoying but it seems like a trailing slash at the end of a path
would be enough to differentiate paths to files from paths to directories.

Thanks,

Micahel Marcin


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk