[ENH] Better read only file opener.

Josh Flowers josh at i33.com
Fri Dec 10 22:37:41 UTC 1999


>Sorry all; this was intended as a private communication. I'll learn 
>how to run these idiot computers one day yet!
>

Actually thanks, it jogged my memory.


>>I just started looking at Alice (beyond the demo) and so far cannot 
>>find where the rabbit is defined anywhere. I'm starting to suspect 
>>it doesn't, that it was loaded from a disk definition once and exist 
>>only in that one window?
>>
>>Is there any way to open an Alice character directly in the World?
>>

Besides loading it in from a .mdl file no, not that I know of.  

With that having been said, I created this change set to make loading Alice actors easier on the
Mac.  Basically it just adds some default options to the popup menu that appears when a read only
file is requested, but can't be found.  This is quite helpful on the Mac where many of the Alice
file names get truncated.

As an aside, what's the general feeling about having a method in a non GUI class that pops up a
menu/dialog (in this case the StandardFileStream|readOnlyFileNamed)?  It seems a bit odd to me,
but it was already there, so it seemed the best place for the fix.






'From Squeak2.6 of 11 October 1999 [latest update: #1578] on 10 December 1999 at 5:22:51 pm'!

!StandardFileStream class methodsFor: 'file creation' stamp: 'jaf 12/10/1999 17:22'!
readOnlyFileNamed: fileName 
 "Open an existing file with the given name for reading."
 "Changed to open a more usefull popup menu.  It now also includes the most likely choices.  jaf
12/10/1999 17:22"
 | selection dir files choices newName |
 (self isAFileNamed: fileName)
  ifTrue: [^ self new open: fileName forWrite: false].
 "File does not exist..."
 dir _ FileDirectory forFileName: fileName.
 files _ dir fileNames.
 choices _ (FileDirectory localNameFor: fileName) correctAgainst: files.
 choices add: 'Choose another name'.
 choices add: 'Cancel'.
 selection _ (PopUpMenu labelArray: choices lines: (Array with: 5) )
    startUpWithCaption: (FileDirectory localNameFor: fileName)
      , '
does not exist.'.
 selection < (choices size - 1) ifTrue: [ newName _ (dir pathName , FileDirectory slash , (choices
at: selection))].
 selection = (choices size - 1) ifTrue: [ newName _ (FillInTheBlank request: 'Enter a new file
name' initialAnswer: (fileName))].
 newName = '' ifFalse: [^ self readOnlyFileNamed: newName].
 ^ self halt.
 ! !





More information about the Squeak-dev mailing list