Subject: Re: [boost] [filesystem] Request for comments on proposedrelative()function
From: Peter Dimov (lists_at_[hidden])
Date: 2014-05-16 10:32:16
Yakov Galka wrote:
> On Fri, May 16, 2014 at 4:20 PM, Peter Dimov <lists_at_[hidden]> wrote:
> > Yakov Galka wrote:
> > relative(x,y) returns a path z (unique up to equivalence), if exists,
> >> such that y / z = x (up to equivalence)
> > If you allow z to be an absolute path, it'd never be unique when x is
> > absolute, because x would be a trivial solution then.
> I think you got it backwords. x is the parameter, z in the solution. So
> yes, if x is absolute, then z is also absolute and equals x. Uniqueness
> isn't broken.
I don't think so.
x = c:/a/b
y = c:/a
Want: z such that y / z = x
Let z = x
"c:/a" / "c:/a/b" = "c:/a/b" = x
Ergo, z = x is a solution.
Let z = "b"
"c:/a" / "b" = "c:/a/b" = x
Ergo, z = "b" is a solution.
x and "b" are not equivalent, which means that the solution is not unique.
(There's also z3 = "/a/b", also an interesting specimen under Windows with
respect to the absolute/relative classification.)
> But they are read by the Windows API, including SetCurrentDirectory,
> GetFullPathName, etc... So there is still a per-drive notion of "current
> directory" in addition to "THE current directory".
They are read but not written. If the environment says that the current
directory of D: is D:\foo and you SetCurrentDirectory( "D:\\bar" ), the
current directory of D: remains D:\foo in the environment. So D:test was
D:\foo\test, becomes D:\bar\test while the current directory is D:\bar, and
then reverts to D:\foo\test when the current directory becomes C:\foo.
Madness, as I said. No sane person uses such paths. :-)
That is not quite in the same category as the encoding, because it affects
the path algebra, and encoding does not.
On second thought, we already need to distinguish between a/b and /a/b, so
perhaps making the distinction between c:a/b and c:/a/b would not be a
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk