[Top][All Lists]

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

Re: [Help-smalltalk] bug: Smalltalk snapshot: aString

From: kraehe
Subject: Re: [Help-smalltalk] bug: Smalltalk snapshot: aString
Date: Mon, 3 Oct 2005 16:44:18 +0200
User-agent: Mutt/1.5.9i

Moin Mike Anderson,

> SystemDictionary methodsFor: 'saving the image'!
> snapshot: aString
>       ObjectMemory snapshot: aString
> !
> !
> - will fix it for you, but really the tutorial should be corrected.

imho, [ Smalltalk snapshot: 'myGnuSmalltalk.image' ] is more newbie
friendly than [ ObjectMemory snapshot: 'myGnuSmalltalk.image' ], as
I think its the goal of the system dictionary to provide easy access
to system internals.

... but I have some related notes for the ObjectMemory>>snapshot method :

Currently this method tries to write into [ File image ] evaluating
into '/usr/local/share/smalltalk/' in my environment. But this
file is read only for normal users, so this method fails. It would be
great to check [ File isWriteable: File image ] before, and to choose
something like '' as the default for an alternative own image
in the ifFalse: case.

    !ObjectMemory class methodsFor: 'saving the image'!
        "Save a snapshot on the image file that was loaded on startup or
        into the local directory. Might raise a file error exception."
        (File isWriteable: File image) ifTrue: [ ^ self snapshot: File image ].
        (File isWriteable: '.')        ifTrue: [ ^ self snapshot: '' ].
        ^ File error: 'Can not write into a'
    ! !

I think this will make BLOXBrowser more newbie friendly, as starting
a Smalltalk from scratch in a new directory and saving an image is
the normal way to create an own image in most other implementations.

btw: my GNU Smalltalk startup script for X is just a workaround for the above.

    mkdir -p smalltalk/gst
    cd smalltalk/gst
    [ ! -f ] &&
        echo "PackageLoader fileInPackage: 'Browser'. ObjectMemory snapshot: 
''!" | gst -gq
    echo "BLOX.BLOXBrowser.BrowserMain new initialize!" |
        gst -gqI 2>&1 | cat > transcript.t

My questions here:

  Does Windoof understand [ File isWriteable: '.' ] ?
  Why does /usr/local/bin/gst create a fresh image from scratch,
  if I start it in my ~/smalltalk/smalltalk-2.1.12/kernel directory ?

Bye Michael
  mailto:address@hidden             UNA:+.? 'CED+2+:::Linux:2.6.12'UNZ+1'           CETERUM CENSEO WINDOWS ESSE DELENDAM

reply via email to

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