Boost logo

Boost :

From: Matt Austern (austern_at_[hidden])
Date: 2002-01-31 16:28:55


Darin Adler wrote:

> On 1/31/02 1:09 PM, "David Abrahams" <david.abrahams_at_[hidden]> wrote:
>
>
>>I think this might be a good argument for a pathname class:
>>
>>assert( std::string("a/b/../c") == std::string("a/c") );
>>
>>Of course, determining path equality reliably is much more complicated than
>>this, and in general you can't do it with just relative paths:
>>
>> path("../a/b/c") ==? path("b/c")
>>
>
> It's a very slippery subject. I would not recommend having a pathname class
> that claims it can compare paths reliably without hitting the disk. But even
> with hitting the disk, since disk contents change, path equality can change,
> so I think it's not really suitable for ==.

There's also a definitional problem. Suppose we're on Unix, and we've
got 'ln a b'. Would we expect path("a") to equal path("b"), since they're
just two names for the same file? My intuition is no, but my intuition
starts getting uneasy when you imagine that a and b are two links to
the same directory, and when you start thinking about a/c and b/c. And
then I get even more uneasy about VMS logical names, which are somewhere
in between Unix symbolic links and Unix environment variables. I'm not
sure I know what it means to ask whether or not two paths are the same.

                        --Matt


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