Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::filesystem - replace_extension question
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2011-04-20 15:29:11


On Wed, Apr 20, 2011 at 11:18, Archie14 <admin_at_[hidden]> wrote:
>
> 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.
>

That's odd. Usually a file named "test" is considered to have a stem
of "test" and an extension of "". (Note that "test.txt" has an
extension of ".txt", but replace_extension adds the dot if the
extension doesn't start with one.)

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

I'd suggest filing a feature request for an "add_extension" mention.

You make a good point that there should be some way other than
operator+ to get "pack.tar.gz" from "pack.tar" and "gz".

~ Scott


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