Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Aug 2006 01:33:21 +0100
From:      "mal content" <artifact.one@googlemail.com>
To:        "Peter Jeremy" <peterjeremy@optushome.com.au>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Relative paths [was: Path transformation]
Message-ID:  <8e96a0b90608211733g8e47320y91be86a3c624108b@mail.gmail.com>
In-Reply-To: <20060821191354.GA729@turion.vk2pj.dyndns.org>
References:  <8e96a0b90608210805m561e29e5g41bdd25ff9dfa94c@mail.gmail.com> <20060821191354.GA729@turion.vk2pj.dyndns.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 21/08/06, Peter Jeremy <peterjeremy@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8e96a0b90608211733g8e47320y91be86a3c624108b>