Boost C++ Libraries: Ticket #5118: replace_extension doesn't work as specified in documentation https://svn.boost.org/trac10/ticket/5118 <ol><li>From Reference (see <a href="http://www.boost.org/doc/libs/1_45_0/libs/filesystem/v3/doc/reference.html#path-replace_extension">http://www.boost.org/doc/libs/1_45_0/libs/filesystem/v3/doc/reference.html#path-replace_extension</a>): </li></ol><pre class="wiki">path&amp; replace_extension(const path&amp; new_extension = path()); Postcondition: extension() == replacement, where replacement is new_extension if new_extension.empty() || new_extension[0] == the dot character, otherwise replacement is the dot character followed by new_extension. Returns: *this </pre><p> Testing this behavior </p> <pre class="wiki">path ph("foo.txt"); std::cout &lt;&lt; ph.replace_extension("exe"); </pre><p> Output: </p> <pre class="wiki">foo </pre><p> Eather change the Reference or fix it in code. </p> <ol start="2"><li>Current implementation doesn't allow to work with complex extentions. </li></ol><pre class="wiki">path ph("foo.txt"); std::cout &lt;&lt; ph.replace_extention(".tar.bz2"); </pre><p> Output: </p> <pre class="wiki">foo.bz2 </pre><ol start="3"><li>There is no function to just add extension. </li></ol><p> something like that: </p> <pre class="wiki">path ph("foo.txt"); std::cout &lt;&lt; ph.add_extension("bz2"); </pre><p> Expected output: </p> <pre class="wiki">foo.txt.bz2 </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5118 Trac 1.4.3 peter.baumann AT methodpark.de Tue, 26 Apr 2011 13:37:40 GMT <link>https://svn.boost.org/trac10/ticket/5118#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5118#comment:1</guid> <description> <p> This is also a regression from V2 -&gt; V3, because in V2 this works as documented. </p> </description> <category>Ticket</category> </item> <item> <author>bitfield.alex@…</author> <pubDate>Tue, 12 Jul 2011 10:36:08 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/5118 https://svn.boost.org/trac10/ticket/5118 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">replace_ext_fix.patch</span> </li> </ul> <p> Here is a patch for replace_extension method </p> Ticket anonymous Fri, 14 Oct 2011 20:55:54 GMT <link>https://svn.boost.org/trac10/ticket/5118#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5118#comment:2</guid> <description> <p> This bug is still in 1.47.0. Any hopes fixing it for the next release? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 10 Jan 2012 10:01:36 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5118#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5118#comment:3</guid> <description> <p> And it is still in 1.48.0<br /> The "Boost Filesystem Do List" found in "boost_1_48_0/libs/filesystem/v3/doc/do_list.html" indicates that the behavior has changed from v2 to v3. </p> <p> On the do list for documentation: Document behavior of path::replace_extension has change WRT argument w/o a dot. </p> <p> Also, "boost_1_48_0/libs/filesystem/v3/test/path_test.cpp" includes multiple tests for this "new" functionality. </p> <p> The documentation should be updated or the patch should be applied! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Sebastian Redl</dc:creator> <pubDate>Mon, 26 Mar 2012 14:00:07 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5118#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5118#comment:4</guid> <description> <p> Still in 1.49. This is a really nasty behavior change from v2. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Mon, 26 Mar 2012 21:19:39 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5118#comment:5 https://svn.boost.org/trac10/ticket/5118#comment:5 <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">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/77571" title="Fix #5118, replace_extension doesn't work as specified in documentation">[77571]</a>) Fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5118" title="#5118: Bugs: replace_extension doesn't work as specified in documentation (closed: fixed)">#5118</a>, replace_extension doesn't work as specified in documentation </p> Ticket Beman Dawes Mon, 26 Mar 2012 21:26:12 GMT <link>https://svn.boost.org/trac10/ticket/5118#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5118#comment:6</guid> <description> <p> The documentation, implementation, and test cases have all had fixes applied. The documentation had failed to mention that any existing extension is removed. The behavior for simple cases has been reverted to the Version 2 behavior, but with corrections so that complex replacements now work. Two test cases from <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5118" title="#5118: Bugs: replace_extension doesn't work as specified in documentation (closed: fixed)">#5118</a> have been added. </p> <p> This ticket also includes a request for an "add_extension" function. That's been deferred since there is a pending request for += operator that would cover the requested functionality. </p> <p> Thanks, </p> <p> --Beman </p> </description> <category>Ticket</category> </item> <item> <author>jonathan.jones@…</author> <pubDate>Wed, 22 Jan 2014 19:56:31 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/5118#comment:7 https://svn.boost.org/trac10/ticket/5118#comment:7 <ul> <li><strong>cc</strong> <span class="trac-author">jonathan.jones@…</span> added </li> </ul> Ticket