[Boost-bugs] [Boost C++ Libraries] #4702: replace_extension truncates path

Subject: [Boost-bugs] [Boost C++ Libraries] #4702: replace_extension truncates path
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-10-01 18:57:28


#4702: replace_extension truncates path
----------------------------------+-----------------------------------------
 Reporter: cheesy4poofs@… | Owner: bemandawes
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: replace_extension |
----------------------------------+-----------------------------------------
 I've recently switched all our code to filesystem v3 and added
 BOOST_FILESYSTEM_NO_DEPRECATE on our builds for good measure. One of the
 changes I had to fix was our use of change_extension(), which was modified
 to use the replace_extension() method. However, some of our code started
 failing and I tracked it down to this example:

         boost::filesystem::path p("C:\\database\\test\\filename");
         p.replace_extension(".db");
         std::cout << p.string() << std::endl;
         // OUTPUT - C:\database\test\filename.db

         p = "C:\\database.1\\test\\filename";
         p.replace_extension(".db"); // bug?
         std::cout << p.string() << std::endl;
         // OUTPUT - C:\database.db

 As you can see, in the second example, it truncates the path and assumes
 the directory name "database.1" has the extension that needs replacing.
 change_extension() did not behave this way.

 Is this the expected behavior?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4702>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC