Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
ProjectLoading
Last updated at 8:21 pm UTC on 2 February 2019
The ProjectLoading class is used to load projects files (pr files).

There are two methods

1.ProjectLoading openOn: stream


 ProjectLoading openOn: stream  

stream contains the content of the project file.

2. ProjectLoading openFromDirectory: aDirectory andFileName: aFileName


The method
 ProjectLoading openFromDirectory: aDirectory andFileName: aFileName
is called by
 TheWorldMenu loadProject

ProjectLoading
 openFromDirectory: aDirectory andFileName: aFileName

	Project current
		do: [| fileAndDir |
			ProgressNotification signal: '1:foundMostRecent'.
			fileAndDir := self bestAccessToFileName: aFileName andDirectory: aDirectory.
			self 
				openName: aFileName 
				stream: fileAndDir first 
				fromDirectory: fileAndDir second
				withProjectView: nil 
                    ]
		withProgressInfoOn: nil
		label: 'project loading'


3. Details

ProjectLoading steps



4. Squeak 5.2a loads project files from 3.x versions


Squeak 5.2a can load pr files written in an earlier version such as 3.8.1.

Depending on the project there might be some issues with conversion of classes.
For some tests see (Etoys) ProjectLoading tests in 5.2.

This is done with an ImageSegmentLoader object (actually LegacyImageSegment, a subclass) which is implemented in Smalltalk code.



5. 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 
 translate to?"
 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:

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:

[.. documentation?..]What I do usually is either or both of:


6. ProjectLoading tests


(Etoys) ProjectLoading tests in 5.2
Test project saving / loading