On 2 December 2017 at 00:39, Alistair Grant <akgrant0...@gmail.com> wrote:

> On 1 December 2017 at 17:32, Prof. Andrew P. Black <bl...@cs.pdx.edu>
> wrote:
> > I have a file reference containing multiple occurrences of .., like this
> >
> > File @
> > /Users/black/graceProgs/lists/../../Development/mg/
> gracelang/albums_junk.grace
> >
> > How do I simplify this to show the simpler path without the .. ?  There
> > should be a method on FileReference, no?  Something like #normalize ?  Or
> > maybe FileReference should do this automatically when it is created?
>
> The answer will depend on which version of Pharo you are using, but for
> Pharo7:
>
>   '/Users/black/graceProgs/lists/../../Development/mg/
> gracelang/albums_junk.grace'
> asFileReference canonicalize
>   "File @ /Users/black/Development/mg/gracelang/albums_junk.grace"
>


While 'canonicalize' obviously fits, it seems a bit exotic and a tongue
twist at five syllables.
I wonder if 'flatten' might also be suitable.  Is there some concept this
wouldn't cover?

(just a random first impression.  happy to be shot down on it)
cheers -ben

Reply via email to