Subject: [Boost-bugs] [Boost C++ Libraries] #12665: boost::filesystem::path::replace_extension(const path& new_extension) produces inintuitive path on special directory
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-12-09 00:21:00
#12665: boost::filesystem::path::replace_extension(const path& new_extension)
produces inintuitive path on special directory
-------------------------------------+-------------------------------------
Reporter: Guillaume Labourey | Type: Feature Requests
<guillaume.labourey@â¦> | Milestone: To Be Determined
Status: new | Version: Boost 1.62.0
Component: None | Keywords: filesystem path
Severity: Problem | replace_extension
-------------------------------------+-------------------------------------
Hi, I have read the specification of
boost::filesystem::path::replace_extension(const path& new_extension).
It is very helpful in most of common use but the method may be ignore
replacement when path represents the following cases:
- dot (.)
- dot-dot (..)
- root-name (C:, //myserver, \\myserver)
The version available in boost 1.62.0 provide the following behaviour
{{{
Replace extension on root path: (arguable)
------------------------------------------
replace_extension("/","txt") = "/.txt"
replace_extension("C:\","txt") = "C:\.txt"
Replace extension on special file-name
--------------------------------------
replace_extension(".","txt") = "..txt"
replace_extension("..","txt") = "...txt"
replace_extension("/foo/.","txt") = "/foo/..txt"
replace_extension("/foo/..","txt") = "/foo/...txt"
Replace extension on root-name
------------------------------
replace_extension("C:","txt") = "C:.txt"
replace_extension("\\myserver","txt") = "\\myserver.txt"
}}}
Regards, Guillaume
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12665> 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:20 UTC