[Etoys] ProjectLoading fix

Yoshiki Ohshima yoshiki at squeakland.org
Thu Jun 14 14:28:16 EDT 2007


  Sorry, Karl, it took a month but I'm now coming back to these
stuff^^;

  If it is not a ZipArchive, it must be really an old project, right?
Anyway, I tested with some projects and also it makes sense to have
the guard.  I published it to the stream now.

  Thank you!

-- Yoshiki

At Thu, 10 May 2007 15:51:08 +0200,
Karl wrote:
> 
> [1  <text/plain; ISO-8859-1 (7bit)>]
> This is a fix to make old project load.
> It should be reviewed by someone who understand this stuff  ;-)
> 
> Karl
> [2 ProjectLoading class.kfr.1.cs <text/plain (7bit)>]
> 'From OLPC2.0 of ''24 October 2006'' [latest update: #1340] on 10 May 2007 at 3:48:39 pm'!
> 
> !ProjectLoading class methodsFor: 'public' stamp: 'kfr 5/10/2007 15:47'!
> openName: aFileName stream: preStream fromDirectory: aDirectoryOrNil
> withProjectView: existingView
> 	"Reconstitute a Morph from the selected file, presumed to be
> represent a Morph saved via the SmartRefStream mechanism, and open it
> in an appropriate Morphic world."
> 
>    	| morphOrList archive mgr substituteFont numberOfFontSubstitutes resultArray anObject project manifests dict |
> 	(self checkStream: preStream) ifTrue: [^ self].
> 	ProgressNotification signal: '0.2'.
> 	archive _ preStream isZipArchive
> 		ifTrue:[ZipArchive new readFrom: preStream]
> 		ifFalse:[nil].
> 	archive ifNotNil:[
> 	manifests _ (archive membersMatching: '*manifest').
> 	(manifests size = 1 and: [((dict _ self parseManifest: manifests first contents) at: 'Project-Format' ifAbsent: []) = 'S-Expression'])
> 		ifTrue: [^ self openSexpProjectDict: dict stream: preStream fromDirectory: aDirectoryOrNil withProjectView: existingView]].
> 
> 	morphOrList _ self morphOrList: aFileName stream: preStream fromDirectory: aDirectoryOrNil archive: archive.
> 	morphOrList ifNil: [^ self].
> 	ProgressNotification  signal: '0.4'.
> 	resultArray _ self fileInName: aFileName archive: archive morphOrList: morphOrList.
> 	anObject _ resultArray first.
> 	numberOfFontSubstitutes _ resultArray second.
> 	substituteFont _ resultArray third.
> 	mgr _ resultArray fourth.
> 	preStream close.
> 	ProgressNotification  signal: '0.7'.
> 		"the hard part is over"
> 	(anObject isKindOf: ImageSegment) ifTrue: [
> 		project _ self loadImageSegment: anObject
> 			fromDirectory: aDirectoryOrNil
> 			withProjectView: existingView
> 			numberOfFontSubstitutes: numberOfFontSubstitutes
> 			substituteFont: substituteFont
> 			mgr: mgr.].
> 	(anObject isKindOf: ImageSegment) ifTrue: [
> 	ProgressNotification  signal: '0.8'.
> 		^ project
> 			ifNil: [self inform: 'No project found in this file' translated]
> 			ifNotNil: [ProjectEntryNotification signal: project]].
> 	self loadSqueakPage: anObject! !
> 
> [3  <text/plain; us-ascii (7bit)>]
> _______________________________________________
> Etoys mailing list
> Etoys at laptop.org
> http://mailman.laptop.org/mailman/listinfo/etoys



More information about the etoys-dev mailing list