Boost logo

Boost Users :

Subject: [Boost-users] boost::filesystem - replace_extension question
From: Archie14 (admin_at_[hidden])
Date: 2011-04-20 14:18:52


I am constructing full path out of directory (c:\temp), filename(test) and
extension (txt).

boost::filesystem::path mypath(dir); // mypath="c:\temp"
mypath /= filename; // mypath="c:\temp\test"

If I call mypath.replace_extension("txt") it will fail because there is no dot
character yet. To proceed further I have to add "." using direct string
manipulation, that kind of break the logic of using filesystem::path.

Question: how to construct full path using directory, filename and extension
strings using only filesystem::path methods?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net