All you need is:
| rr | rr := SmartRefStream fileNamed: 'MyModel.obj'. reconstitutedModel := rr next. rr close.
... whereupon the variable reconsitutedModel will point to your freshly-internalized model.
Cheers,
-- Scott
At 10:35 AM -0300 8/16/04, Germ·n S. Arduino wrote:
Hi:
I've a model with only one instance in the image and I backup this model with:
| rr | rr := SmartRefStream fileNamed: 'MyModel.obj'. rr nextPut: MyModel someInstance. rr close.
But I can't figure out how to read again inside the image, I've tried, between several attempts,:
| rr | rr := SmartRefStream fileNamed: 'MyModel.obj'. MyModel allInstances do: [:each1 | each1 := rr next]. rr close.
I'm sure that I've only one instance in the model (worked with Seaside and Mewa) but I can't figure out how to recover the data in the file 'MyModel.obj' to rebuild my objects in the image.
The previous MyModel allInstances do: [:each1 | each1 := rr next] fails with 'attempt to index non-existent element in an ordered collection'.
I can't imagine how to replace the "data" of my live instance of MyModel with the data saved in the external file "MyModel.obj".
Any help will be appreciated.
gsa.