Relative paths [was: Path transformation]
mal content
artifact.one at googlemail.com
Tue Aug 22 00:33:23 UTC 2006
On 21/08/06, Peter Jeremy <peterjeremy at optushome.com.au> wrote:
> 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.
Done and done! Just checking to see that nobody had already done
it in the tree somewhere.
cheers,
MC
More information about the freebsd-hackers
mailing list