commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@gmail.com>
Subject Re: [IO] Filename relativiser?
Date Tue, 22 May 2007 15:53:08 GMT
On 5/22/07, sebb <sebbaz@gmail.com> wrote:
> On 21/05/07, sebb <sebbaz@gmail.com> wrote:
> > On 21/05/07, Niall Pemberton <niall.pemberton@gmail.com> wrote:
> > > On 5/21/07, sebb <sebbaz@gmail.com> wrote:
> > > > Are there any plans to implement a filename relativiser?
> > > >
> > > > i.e., given an absolute directory and absolute filename it would
> > > > return a relative filename.
> > > >
> > > > e.g. (in Unix syntax):
> > > >
> > > > /a/b/c and /a/b/c/d/e.txt => d/e.txt
> > > >
> > > > and optionally:
> > > >
> > > > /a/b/c/f and /a/b/c/d/e.txt => ../d/e.txt
> > > >
> > > > It does not look particularly difficult to do, but it does not seem
> > > > trivial either, so it might be a useful addition to Commons IO...
> > >
> > > +1 sounds like a good candidate for FilenameUtils - commons JCI has a
> > > "relative" method in its ConverstionUtils class
> >                            s/stion/sion/
> > >
> > >  http://tinyurl.com/2kj6ul
> >
> > Thanks. That would handle the first case above, but not the optional case.
>
> Actually it does not handle
>
> /a/b/c/ and /d/e/f/g.txt
>
> as it assumes that the base is a proper parent of the file, which is
> presumably true for JCI, but not for the general case I need.

Just thought it would be good to consider JCI's use case when
considering a new feature for IO.

Niall

> > The optional case probably needs a "dottiness" (!) limit - i.e. how
> > many ".." segments are allowed.
> >
> > S.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message