[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Directory create: 'something' "bug"

From: Michael Fellinger
Subject: Re: [Help-smalltalk] Directory create: 'something' "bug"
Date: Wed, 6 Sep 2006 19:59:33 +0900
User-agent: KMail/1.9.4

On Wednesday 06 September 2006 19:38, Bram Neijt wrote:
> Hi.
> The following gives an error:
> Directory create: 'hello'!
> while
> Directory create: './hello'!
> works. The error is:
> st> Directory create: 'hello'!
> Object: '' error: Invalid index 1: index out of range
> String(Object)>>#primError:
> SystemExceptions.IndexOutOfRange(Exception)>>#defaultAction
> optimized [] in Exception class>>#coreException
> SystemExceptions.IndexOutOfRange(Signal)>>#activateHandler:
> SystemExceptions.IndexOutOfRange(Exception)>>#signal
> SystemExceptions.IndexOutOfRange class>>#signalOn:withIndex:
> String(Object)>>#checkIndexableBounds:
> String>>#at:
> File class>>#fullNameFor:
> VFS.RealFileHandler>>#name:
> VFS.VFSHandler class>>#for:
> Directory class>>#create:
> UndefinedObject>>#executeStatements
> nil
> self == bug
>   ifTrue [ 'This is a bugreport' printNl.]
>   ifFalse [ 'What is the reason for this?' printNl.] !

I did a little investigation, and found following.

st> Directory class sourceCodeAt: #create:!
'create: dirName
    "Create a directory named dirName."
    ^(VFS.VFSHandler for: (File pathFor: dirName))
        createDir: (File stripPathFrom: dirName)

eventually i tried

st> File pathFor: 'foobar'!
st> File pathFor: './foobar'!

and saw that this matched your backtrace :)
so, in the end i would say it is intended behaviour, since pathFor just does 
what it should (if there's no path, why should it make up one?)
however, Directory create: should become a little bit more intelligent, since 
it's clear that if you create a directory without path, it should be the 
current one.
or maybe delegate that down to VFS.VFSHandler #for:createDir:
anw, i think that should be fixed, as it may not be a bug, but it's 
unconvinent and not intuitive :)

> VFS.VFSHandler class>>#for:
> Directory class>>#create:

> Greetings,
>   Bram

reply via email to

[Prev in Thread] Current Thread [Next in Thread]