On Tue, 19 Dec 2000 Torsten.Bergmann@phaidros.com wrote:
Another slight correction - ProjectViewMorph does all that for you. So the loader script merely becomes this:
ProjectViewMorph openFromFile: (FileStream requestURLStream: 'mySqueaklet.extSeg')
But:
#openFromFile sends the message #asUnZippedStream to the given string and this method is not implemented for Strings in the plugin image I've found at: (http://wwwisg.cs.uni-magdeburg.de/~bert/squeak/plugin/download.html#win)
I just double-checked. The SqueakPlugin.image contained in http://wwwisg.cs.uni-magdeburg.de/~bert/squeak/plugin/npsqueak-noarch.zip does have that method, implemented by ReadWriteStream.
-- Bert
On Tue, 19 Dec 2000, Bert Freudenberg wrote:
On Tue, 19 Dec 2000 Torsten.Bergmann@phaidros.com wrote:
Another slight correction - ProjectViewMorph does all that for you. So the loader script merely becomes this:
ProjectViewMorph openFromFile: (FileStream requestURLStream: 'mySqueaklet.extSeg')
But:
#openFromFile sends the message #asUnZippedStream to the given string and this method is not implemented for Strings in the plugin image I've found at: (http://wwwisg.cs.uni-magdeburg.de/~bert/squeak/plugin/download.html#win)
I just double-checked. The SqueakPlugin.image contained in http://wwwisg.cs.uni-magdeburg.de/~bert/squeak/plugin/npsqueak-noarch.zip does have that method, implemented by ReadWriteStream.
Oh, you wrote "not implemented for Strings" - can you tell what String this was sent? That's odd.
Actually, requestURLStream: should return nil when an error occured. So it would be wise to check the stream first:
| url stream | url _ 'mySqueaklet.extSeg'. stream _ FileStream requestURLStream: url ifError: [^ PopUpMenu notify: 'Not in a browser?']. stream ifNil: [^ PopUpMenu notify: 'Error downloading ', url]. ProjectViewMorph openFromFile: url
Apropos requested URLStreams: Keep in mind these actually are files located in the browser's cache directory, which is outside the Squeak Plugin's file sand box. It's thus not possible to close and reopen the file. Anything involving Stream>>reset will fail, because this is (for no good reason, IMNSHO) implemented as #reopen.
On a related note, it's best to treat these as pipes rather than files (that means no seeking allowed etc.) because in future Squeak Plugin versions most certainly the current mechanism will be extended to actually stream the data into Squeak as it arrives from the browser. Currently, the whole file is downloaded first, and then handed over to Squeak.
-- Bert
squeak-dev@lists.squeakfoundation.org