Boost logo

Boost :

Subject: Re: [boost] [Filesystem] v3 path separator changes
From: Beman Dawes (bdawes_at_[hidden])
Date: 2013-03-23 11:03:26


On Sat, Mar 16, 2013 at 12:54 PM, Alexander Lamaison <awl03_at_[hidden]> wrote:
> I'm finally getting round to moving to Filesystem v3 and now my code is
> breaking all over the place. The cause is the output of string() on
> Windows which has changed behaviour.
>
> I'm manipulating Unix paths for use over SFTP, but doing so on Windows.
> For instance I might want to append "c" to the Unix path "/a/b".
>
> path p("/a/b");
> p /= "c";
> cout << p.string();
>
> In version 2 this would output "/a/b/c" but now it produces "/a/b\c".
> Why the breaking change?

IIRC, it was partially requests from users and partially the
realization that most users want platform independent syntax but
platform dependent semantics.

If you would like your example to append a slash, use the (relatively
new) path concatenation operator +=

    p += "/c";

If you would rather continue to use operator /= then change the output to

    cout << p.generic_string();

HTH,

--Beman


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