Boost C++ Libraries: Ticket #5529: Problem with boost::filesystem::path https://svn.boost.org/trac10/ticket/5529 <p> Hi, </p> <p> I upgraded my Boost libraries from version 1.45.0 to 1.46.1 and now the behavior of the following test program has changed: </p> <blockquote> <p> #include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;boost/filesystem.hpp&gt; </p> </blockquote> <blockquote> <p> using std::cout; using std::endl; using boost::filesystem::path; </p> </blockquote> <blockquote> <p> int main() { </p> <blockquote> <p> path vPath("data/testfile"); vPath.make_preferred(); </p> </blockquote> </blockquote> <blockquote> <blockquote> <p> cout &lt;&lt; "vPath = " &lt;&lt; vPath.string() &lt;&lt; endl; </p> </blockquote> <p> } </p> </blockquote> <p> When running the above on Windows using Boost version 1.45.0, I get the following result: </p> <blockquote> <p> vPath = data\testfile </p> </blockquote> <p> But now runnning the above on Windows using Boost version 1.46.1, I get the following result: </p> <blockquote> <p> vPath = data/testfile </p> </blockquote> <p> Was this behavior change intentional because the documentation states that the behavior should be as per the result using Boost 1.45.0. </p> <p> Regards, </p> <p> Leo </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5529 Trac 1.4.3 Leo Carreon <lcarreon@…> Tue, 17 May 2011 22:26:36 GMT <link>https://svn.boost.org/trac10/ticket/5529#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5529#comment:1</guid> <description> <p> Hi, </p> <p> Can I please get some feedback on this. </p> <p> Regards, </p> <p> Leo </p> </description> <category>Ticket</category> </item> <item> <author>Leo Carreon <lcarreon@…></author> <pubDate>Wed, 25 May 2011 02:22:03 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5529#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5529#comment:2</guid> <description> <p> Hi, </p> <p> What I meant in my original description of the problem above is that in Boost 1.46.1 the function path::make_preferred() is converting backslashes to slashes on a Windows environment which is contrary to what the documentation says. </p> <p> I have looked in the Boost 1.46.1 source code and that is exactly what the code is doing, i.e. replacing backslashes with slashes using a std::replace() call. This new version of path::make_preferred() is now called by path::generic_string() and path::generic_wstring(). </p> <p> Whereas in Boost 1.45.0, path::make_preferred() converts slashes to backslashes and a private function path::m_portable() converts backslashes to slashes with both functions using a for loop to make the replacements. In this version, path::generic_string() and path::generic_wstring() call path::m_portable(). </p> <p> In my opinion, the 1.45.0 code is correct and could be improved by replacing the for loops with the std::replace() calls. A better name for path::m_portable() could be path::make_generic(). </p> <p> I have also checked the code in Boost 1.46.0, in this version path::make_preferred() is identical to that in Boost 1.45.0 thus the undocumented change is actually between Boost 1.46.0 and Boost 1.46.1. </p> <p> I hope my explanation above clarifies this matter. </p> <p> Regards, </p> <p> Leo </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 25 May 2011 09:43:51 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5529#comment:3 https://svn.boost.org/trac10/ticket/5529#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">duplicate</span> </li> </ul> <p> This has been fixed on the release branch, see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5434" title="#5434: Bugs: path.make_preferred() does not work as specified on Windows (closed: fixed)">#5434</a>. </p> Ticket