From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-12-16 12:41:28
At 12:12 PM 12/16/2002, Glen Knowles wrote:
>From: Beman Dawes [mailto:bdawes_at_[hidden]]
>> > While doing so one missing function
>> >came to my mind (or did I just overlook it). It came to my mind that
>> >some time in the future I might want to create a relative path, given
>> >"complete" path and a "complete" reference directory. Is there such a
>> >"make_relative" function? Would it be hard to add? Note that I do not
>> >ned it at this time and there is thus no hurry. I am mostly curious if
>> >others might have similar needs, and how hard it would be to add it?
>>Have you looked at path::relative_path()?
>>You could use it like this:
>> a.root_path() / b.relative_path()
>>To compose a new bath based on a's root information and b's relative
>>information. Or did I misunderstand what you needed?
>I think what he might be asking for is something like:
>make /my/full/path relative to /my/base/dir produces ../../full/path
The practical problem is determining if two paths are the same. What if the
example was rewritten:
make /My/full/path relative to /my/base/dir
make /foo/full/path relative to /my/base/dir
Note that on some operating systems, "/foo" may be the same directory as
Is there a reliable way on all operating systems to tell if two textually
different paths represent the same underlying directory or file?
It would be easy for a Filesystem Library user to write a convenience
function subject to the limitation it only considers lexically identity.
I've always felt that is misleading and error prone. For safety, you really
would have to have an operating system function that answers the question
"do these two paths represent the same entity?"
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk