bug in File Locator isRoot

Jeff Sparkes jsparkes at gmail.com
Sat Dec 31 19:46:26 PST 2005


Excellent.   I've started writing some unit tests as a learning
exercise, and quickly
ran into that bug.  I'll send a patch in when I have a bit more done.

Is there a way to convert a string into a File or Directory depending
on the contents.
For example, when reading the arguments to a script, you won't know in
advance which of them



On 12/28/05, Brian Rice <water at tunes.org> wrote:
> The comment for isRoot on File Locator states that it means that the
> locator represents either the root directory entry (unlikely, but it
> could happen), or a file within that. As long as that's meaningful, I
> think I'll keep it in.
>
> I've corrected File RelativeLocator's implementation as you suggest,
> to also check the basePath. This fixes your test case and most others
> I can think of.
>
> The patch is uploaded - new images will be available shortly.
>
> On Dec 28, 2005, at 7:47 AM, Jeff Sparkes wrote:
>
> > If you create a File Locator with a simple file name, isRoot returns
> > true.  I think
> > it should include the basePath in determining isRoot.  Is it even
> > possible for a
> > File RelativeLocator to be a root?  Further inspection shows that File
> > and Directory
> > are separate classes, so it should be impossible for a File to be
> > root.
> >
> >
> > Slate: Growing heap to 6984568 bytes.
> > Nil
> > Slate 1>  addSlot: #f valued: ('slate.image' as: File Locator).
> > lobby
> > Slate 2> f isRoot.
> > True
> > Slate 3> f path.
> > {"ExtensibleArray"}
> > Slate 4> f.
> > P'slate.image'
> > Slate 5> f basePath.
> > ("LogicalDirectory" parentResource: Nil. handle: Nil. readStream: Nil.
> > writeStream: Nil.
> >     locator: P'd:\src\slate\main\'. resolver: [(arity: 0)])
> > Slate 6>
>
> --
> -Brian
> http://tunes.org/~water/brice.vcf
>
>
>
>




More information about the Slate mailing list