Boost logo

Boost Users :

From: Georgios Diamantopoulos (georgiosd_at_[hidden])
Date: 2005-01-04 12:13:19


Hello,

I've always wanted some functionality to determine the relative path
between two paths. Maybe something like this can be added to the
convinience.hpp or otherwise:

fs::path relative_path_of(fs::path const &base, fs::path const &full)
{
    std::string fullStr = full.string();
    std::string baseStr = base.string() + "/"; // add a slash so that it
returns the relative path

    boost::erase_first(fullStr, baseStr);
   
    return fs::path(fullStr);
}

Cheers,

Georgios


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