|
Boost : |
Subject: Re: [boost] boost::filesystem::path frustration
From: Dave Abrahams (dave_at_[hidden])
Date: 2013-01-25 18:52:41
on Fri Jan 25 2013, "Peter Dimov" <lists-AT-pdimov.com> 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).
IMO paths are abstract entities that aren't necessarily realized in the
local filesystem. The results of pure path manipulations must therefore
not depend on the state of the local filesystem. Operations accepting
paths as input that depend on the local filesystem structure should be
seen as operations on the filesystem rather than operations on paths.
-- Dave Abrahams BoostPro Computing Software Development Training http://www.boostpro.com Clang/LLVM/EDG Compilers C++ Boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk