Boost logo

Boost Users :

From: Hermann Rodrigues (hermann.rodrigues_at_[hidden])
Date: 2005-10-31 07:55:57


Hi,

I am running into the following problem these days:

I need to translate an absolute path to a path relative to the current
directory on Windows. The translation process need to include all
required ".." directory specifiers in the path to make sure it can be
accessed from the current directory.

The following path samples may clarify the problem.

--------------------------------------------------------------------------------
Current Directory: C:\x\y\z
Absolute Path: C:\x\y\z\k\w.txt
Translated Path: k\w.txt (C:\x\y\z is a common parent)

Current Directory: C:\x\y\z
Absolute Path: D:\a\b\c\d.txt
Translated Path: D:\a\b\c\d.txt (no common parent found)

Current Directory: C:\x\y\z
Absolute Path: C:\x\k\w.txt
Translated Path: ..\..\k\w.txt (C:\x is a common parent)
--------------------------------------------------------------------------------

Is there any built-in support in the boost filesystem library to
achieve such translation? At first I thought the path::relative_path
could solve my problem but it does not seem to take into account the
current directory, only the path itself.

Any sugestion?

Thanks in advance.

Hermann


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