Last updated at 3:31 am UTC on 17 June 2018
The ProjectLoading class has two methods to load projects files (pr files).
Two are shown below
1.ProjectLoading openOn: stream
ProjectLoading openOn: stream
is called when you drop a pr file onto the desktop.
stream contains the content of the project file.
The calls comes from an instance of ExternalDropHandler in #handle:in:dropEvent:
2. ProjectLoading openFromDirectory: aDirectory andFileName: aFileName
ProjectLoading openFromDirectory: aDirectory andFileName: aFileName
is called by
openFromDirectory: aDirectory andFileName: aFileName
do: [| fileAndDir |
ProgressNotification signal: '1:foundMostRecent'.
fileAndDir := self bestAccessToFileName: aFileName andDirectory: aDirectory.
stream: fileAndDir first
fromDirectory: fileAndDir second
label: 'project loading'
details: ProjectLoading steps
3. Notes about Squeak 6.0a
Squeak 6.0a can load pr files written in an earlier version such as 3.8.1. Depending on the project there are issues with conversion of classes.
For this it uses an ImageSegmentLoader which is implemented in Smalltalk code.
4. Notes about the content of the project pr file and project loading (2004)
Brad Fuller: July 11, 2004 I'm getting the following message trying to read a project:
"Reading an instance of . Which modern class should it
With the following selections
Let me type the name now
Let me think about it
Let me find a conversion file on the disk.
The class(es) that are reported do not exist in the image. I clearly need to know more about "projects". Can you point me in a direction of documentation?
Ned Konz That's the problem. The project file contains a serialized version of the
interesting objects in the project. But it doesn't contain classes or method definitions, unless you explicitly choose to store the change set with the project (and unless the change set has all of the required definitions).
So a reference to a class is instead stored in a .pr file as something that,
when de-serialized, is equivalent to:
DiskProxy global: #YourClass selector: #yourself args: #()
and then is resolved by looking in the Smalltalk dictionary under #YourClass.
But of course YourClass doesn't exist, and so Squeak offers to let you either:
- load a change set that might include conversion methods
- say that instances of YourClass should really become instances of SomeOtherClass
- stop loading
Look at implementors of #objectForDataStream: to find more special cases like this.
If you want to distribute projects and your own code, the easiest way to do it is either to:
- Ensure that all the class and method definitions you need are in the project's change set (you can use the Dual Change Sorter to copy methods from other change sets, as necessary), or
- Package the .pr and the appropriate Smalltalk code (.cs, .mcz, .st, etc.)inside a SAR file (a zip file that Squeak knows how to load).
[.. documentation?..]What I do usually is either or both of:
- Read the code (look here for SmartRefStream/ ReferenceStream, DiskProxy, and methods like objectForDataStream: and the "file in/out" and "objects from disk" method categories)
- Poke around on the Squeak Swiki.
- Do some internet searching