Behavior change in path operator /

Hi all, I'm updating my boost version from 1.33 to 1.38... That's a big step, and I've found a difference in operator / of filesystem::path. In 1.33, when I was doing : path a = path("d:/toto/titi"); path b = path("d:/tata/tutu"); path c = a/b; I had c == "d:/tata/tutu" So if b was a complete (or absolute) path, the result was b, whatever value has "a". I don't know if this behavior was correct or not, but we were using it this way, it was fine. Now with 1.38, I have : c == "d:/toto/titi/d:/tata/tutu" That is at first different from previous behavior, and also obviously wrong for a path syntax on Windows at least. It seems also that in 1.33 a path like this would raise an exception. I've tried to find when, in what version, this change occured, but couldn't find it in release notes. Was this change made intentionanly, if yes, what is the reason for that? And if I want previous behavior, I have 2 solutions. Fix my code, of fix boost code. I'm afraid that if I fix boost code I could break some boost functionnalities, or can I do it with no problem ? Thanks, Gérald

2009/7/15 Gérald Fauvelle <gf@a2ia.com>:
I've tried to find when, in what version, this change occured, but couldn't find it in release notes.
In the current version, at least, this behaviour for / comes from the explicitly-specified /=, so checking the docs for that should fine the change. I don't know why it was made, though I suspect
And if I want previous behavior, I have 2 solutions. Fix my code, of fix boost code. I'm afraid that if I fix boost code I could break some boost functionnalities, or can I do it with no problem ?
If you decide to fix your code, apparently the function that does what you want in the current version is named complete: http://www.boost.org/libs/filesystem/doc/reference.html#Operations-functions

Le 15/07/2009 23:22, Scott McMurray a ecrit :
2009/7/15 Gérald Fauvelle <gf@a2ia.com>:
I've tried to find when, in what version, this change occured, but couldn't find it in release notes.
In the current version, at least, this behaviour for / comes from the explicitly-specified /=, so checking the docs for that should fine the change. I don't know why it was made, though I suspect
"The path stored in rhs is appended to the stored path." Well, that's clear, but it doesn't say why it changed, and why it can return a non valid path.
And if I want previous behavior, I have 2 solutions. Fix my code, of fix boost code. I'm afraid that if I fix boost code I could break some boost functionnalities, or can I do it with no problem ?
If you decide to fix your code, apparently the function that does what you want in the current version is named complete: http://www.boost.org/libs/filesystem/doc/reference.html#Operations-functions
Thanks, for the moment, I fixed some part of my code checking path with is_complete, but as we use this almost everywhere, I think I would prefer to do it in boost. Are there unit tests of boost path that I can run to be sure that nothing is broken ? Gérald
participants (2)
-
Gérald Fauvelle
-
Scott McMurray