Thread: boost::filesystem - relative paths

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    95

    boost::filesystem - relative paths

    I have some path (Folder) that I'm searching:

    Code:
    for (directory_iterator It (Folder); It != EndIt; ++It) {
    
    	Contents.push_back (*It);
    }
    Now, I have a map:

    std::map<string, bfs:ath>

    The first member should contain the path of the file or folder (which is the second member) relative to Folder.

    Does boost::filesystem provide a simple way to do this, or am I going to have to write my own function? path::relative_path ( ) seems to be of no help, because it will only return paths relative to the root (e.g. the drive letter on windows).

  2. #2
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    I bet you can find your answers at this site.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  3. #3
    Registered User
    Join Date
    Dec 2004
    Posts
    95
    Well that's why I posted; there isn't anything I can see from the docs that does what I want. It's pretty trivial to implement, but I was suprised there's no "relative_to" function in the library.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. exec with system(..), how to use relative paths?
    By sept in forum C++ Programming
    Replies: 2
    Last Post: 08-24-2008, 01:22 PM
  2. relative paths with autotools
    By zxcv in forum Tech Board
    Replies: 1
    Last Post: 02-28-2008, 11:18 AM
  3. relative paths with XPath in libxml2
    By sparcz in forum C Programming
    Replies: 3
    Last Post: 10-12-2006, 02:49 AM
  4. using relative file paths..?
    By anomaly in forum C++ Programming
    Replies: 2
    Last Post: 11-25-2003, 03:36 PM
  5. Newbie Question: File Input and Relative Paths
    By Ashes999 in forum C++ Programming
    Replies: 11
    Last Post: 05-23-2003, 04:21 AM