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

next in thread | previous in thread | raw e-mail | index | archive | help

--lrZ03NoBR/3+SXJZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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.

--=20
Peter Jeremy

--lrZ03NoBR/3+SXJZ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFE6gXy/opHv/APuIcRAiBaAJ0TepOIAZzKg3tZbDd8VtoVHSEXVgCgwTv8
AOwdgH3HHN+u87y2DudzzLk=
=oQJv
-----END PGP SIGNATURE-----

--lrZ03NoBR/3+SXJZ--



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