Boost logo

Boost :

Subject: Re: [boost] boost::filesystem::path frustration
From: Neil Groves (neil_at_[hidden])
Date: 2013-01-25 14:39:23


On Fri, Jan 25, 2013 at 5:37 PM, Peter Dimov <lists_at_[hidden]> wrote:

> Neil Groves wrote:
>
> For illustration:
>> I suspect that the result you want from fn("/usr/sbin/../bin/test1.**
>> txt",
>> "/usr/bin/test2.txt") is "/usr/bin" rather than "/usr".
>>
>
> Not necessarily. If /usr/sbin is a symbolic link to, say, /opt/sbin, the
> 'real' common prefix is not /usr/bin. Depending on the use case, /usr may
> well be more correct, it being the logical common ancestor (but not the
> physical common ancestor).
>
> I don't disagree with your point at all.

I was attempting to communicate that we almost always want to handle the
relative canonicalisation in a known and obvious manner while the other
complexities due to file links and whatnot are more complicated with no
single obviously correct answer under all circumstances. Hence the point
you are making is one I was attempting to make.

The main point, of course, was that the simplistic handling of just using
unadjusted boost::filesystem::paths without any adjustment is often a
source of error when attempting to implement this type of algorithm.

Neil Groves


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