I have a certain boost::filesystem::path in hand and I\'d like to append a string (or path) to it.
boost::filesystem::path p(\"c:\\\\dir\");
p.appen
#include
#include
#include
int main() {
boost::filesystem::path p (__FILE__);
std::string new_filename = p.leaf() + ".foo";
p.remove_leaf() /= new_filename;
std::cout << p << '\n';
return 0;
}
Tested with 1.37, but leaf and remove_leaf are also documented in 1.35. You'll need to test whether the last component of p is a filename first, if it might not be.