From: David Alan Black Date: 2002-04-26T22:34:00+09:00 Subject: Re: expand_path and overlap Hello -- On Fri, 26 Apr 2002, Morris, Chris wrote: > I'm wanting something similar to expand_path, but that will detect overlap. > So given this: > > expand_path("b/c/f", "/a/b/c/d/e") > > it would return: > > "/a/b/c/f" > > expand_path currently returns: > > "/a/b/c/d/e/b/c/f" > > No argument with expand_path -- a function that did what I wanted would not > allow a user to navigate to /a/b/c/d/e/b/c/f from /a/b/c/d/e without > specifying an absolute path ... but I think my version will suit my needs. > > So ... is there anything out there in Ruby land that does this already > before I build this myself? I find this an interesting puzzle. Question: what would this return: collapse_path("b/c/f", "/a/b/c/d/e/b/c/g/h") #^^^^^^^^^^^^ or whatever :-) ? David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav