Relative paths [was: Path transformation]

Peter Jeremy peterjeremy at optushome.com.au
Mon Aug 21 19:13:57 UTC 2006


On Mon, 2006-Aug-21 16:05:33 +0100, mal content wrote:
>I have another favour to ask: Is there a function that can
>take two absolute paths and generate a relative path, from
>source to destination?

I don't think there's any such function.  My suggestion is to roll
your own, based on realpath(3) by replacing the getcwd() with the
first path and adding enough '../' to the second path to reach a
common directory (or root) from the first path.

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20060821/b260a609/attachment.pgp


More information about the freebsd-hackers mailing list