Boost logo

Boost :

From: Glen Knowles (gknowles_at_[hidden])
Date: 2002-11-27 23:30:48

>From: Beman Dawes [mailto:bdawes_at_[hidden]]
> > >>is_absolute() - true if the directory (sans drive) starts with
> > >>a / (c:/, /, /blah are absolute; c:blah, blah, ../blah are not)
> > >
> > >That's been added too.
> > >
> > >Hum... On multi-rooted operating systems like Windows, "/" and
> > >"/blah" are relative to the current drive, and thus not considered
> > >absolute. AFAIR, that was mentioned several times and was not
> > >controversial. What was your rationale?
> >
> >I don't know if it was controversial, but I did bring this up during
> >the review and I do think its very important. The basic definition
> >of an absolute path should be a path that overrides the base path
> >during a resolve. To rephrase, 'foo' is relative because it is an
> >adjustment from the current directory, '/foo' on the other hand
> >takes precendence over the current path. To re-rephrase, '/foo' is
> >relative to the current drive, but not to the current directory.
>That seems like a stretch to me. With your definition, "absolute" isn't
>equivalent to "not relative", and that seems counter intuitive.

I must have been unclear, absolute is the same as not relative. A path
is either absolute or relative with respect to its root. So my last
example above where I essentially said that "an absolute path is
relative to its root" may have been misleading.

resolve() could be considered a bit odd, but I find it somewhat baffling
that the make_absolute() seems strange to you, it is the way windows, urls,
and every other system I've ever used that has the concept of drive or
authority has worked.

Some examples that use the make_absolute semantics I've described:
1. "dir <path>" from the windows command line.
2. The .NET GetAbsolutePathName(pathspec) function
3. GetFullPathName(...) from the Windows SDK
4. Basically any windows or os/2 system function that takes a path

Actually #2 might be an indicator that I'm in the minority by call
"/path" sans drive absolute. . . on the other hand the URL rules clearly
specify "/path" as absolute so maybe not.

>There has also been so consideration of providing has_xxx query functions,
>which would express the above as:
> foo.has_root_directory()


>If has_xxx query functions are provided, then there isn't really a need for

>a separate absolute query, since foo.has_root() (or
>foo.has_root_directory(), for those who prefer your definition.)
>Not having a function named absolute() might be safest, too, because it
>would force users to choose exactly the has_xxx function they wanted,
>rather than jumping to a conclusion about the semantics of absolute().

That works.


>Understood. AFAIK, it is going to be possible to write both your
>make_absolute() and resolve() functions in a portable manner using path
>member functions.

Good, this is what's important.


Boost list run by bdawes at, gregod at, cpdaniel at, john at