[squeak-dev] The Trunk: System-fbs.570.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jul 18 18:13:26 UTC 2013


Frank Shearar uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-fbs.570.mcz

==================== Summary ====================

Name: System-fbs.570
Author: fbs
Time: 18 July 2013, 5:29:27.909 pm
UUID: cb8add83-ada4-454b-a59c-3a0edf6f57b7
Ancestors: System-fbs.569

Move those methods inducing a Files -> Compression dependency to System.

This move makes sense for the methods for loading the sources & changes files. The #fileIn: is pretty arbitrary. Really, I'd like to see that in a separate code-loading package, but System's close enough for now.

=============== Diff against System-fbs.569 ===============

Item was added:
+ ----- Method: FileDirectory class>>openChanges:forImage: (in category '*System-Files') -----
+ openChanges: changesName forImage: imageName
+ "find the changes file by looking in
+ a) the directory derived from the image name
+ b) the DefaultDirectory (which will normally be the directory derived from the image name or the SecurityManager's choice)
+ If an old file is not found in either place, check for a read-only file in the same places. If that fails, return nil"
+ 	| changes fd |
+ 	"look for the changes file or an alias to it in the image directory"
+ 	fd := FileDirectory on: (FileDirectory dirPathFor: imageName).
+ 	(fd fileExists: changesName)
+ 		ifTrue: [changes := fd oldFileNamed: changesName].
+ 	changes ifNotNil:[^changes].
+ 
+ 	"look for the changes in the default directory"
+ 	fd := DefaultDirectory.
+ 	(fd fileExists: changesName)
+ 		ifTrue: [changes := fd oldFileNamed: changesName].
+ 	changes ifNotNil:[^changes].
+ 
+ 	"look for read-only changes in the image directory"
+ 	fd := FileDirectory on: (FileDirectory dirPathFor: imageName).
+ 	(fd fileExists: changesName)
+ 		ifTrue: [changes := fd readOnlyFileNamed: changesName].
+ 	changes ifNotNil:[^changes].
+ 
+ 	"look for read-only changes in the default directory"
+ 	fd := DefaultDirectory.
+ 	(fd fileExists: changesName)
+ 		ifTrue: [changes := fd readOnlyFileNamed: changesName].
+ 	"this may be nil if the last try above failed to open a file"
+ 	^changes
+ !

Item was added:
+ ----- Method: FileDirectory class>>openSources:andChanges:forImage: (in category '*System-Files') -----
+ openSources: sourcesName andChanges: changesName forImage: imageName 
+ 	"Open the changes and sources files and install them in SourceFiles. Inform the user of problems regarding write permissions or CR/CRLF mixups."
+ 	"Note: SourcesName and imageName are full paths; changesName is a  
+ 	local name."
+ 	| sources changes msg wmsg |
+ 	msg := 'Squeak cannot locate &fileRef.
+ 
+ Please check that the file is named properly and is in the
+ same directory as this image.'.
+ 	wmsg := 'Squeak cannot write to &fileRef.
+ 
+ Please check that you have write permission for this file.
+ 
+ You won''t be able to save this image correctly until you fix this.'.
+ 
+ 	sources := self openSources: sourcesName forImage: imageName.
+ 	changes := self openChanges: changesName forImage: imageName.
+ 
+ 	((sources == nil or: [sources atEnd])
+ 			and: [Preferences valueOfFlag: #warnIfNoSourcesFile])
+ 		ifTrue: [SmalltalkImage current platformName = 'Mac OS'
+ 				ifTrue: [msg := msg , '
+ Make sure the sources file is not an Alias.'].
+ self inform: (msg copyReplaceAll: '&fileRef' with: 'the sources file named ' , sourcesName)].
+ 
+ 	(changes == nil
+ 			and: [Preferences valueOfFlag: #warnIfNoChangesFile])
+ 		ifTrue: [self inform: (msg copyReplaceAll: '&fileRef' with: 'the changes file named ' , changesName)].
+ 
+ 	((Preferences valueOfFlag: #warnIfNoChangesFile) and: [changes notNil])
+ 		ifTrue: [changes isReadOnly
+ 				ifTrue: [self inform: (wmsg copyReplaceAll: '&fileRef' with: 'the changes file named ' , changesName)].
+ 
+ 			((changes next: 200)
+ 					includesSubString: String crlf)
+ 				ifTrue: [self inform: 'The changes file named ' , changesName , '
+ has been injured by an unpacking utility.  Crs were changed to CrLfs.
+ Please set the preferences in your decompressing program to 
+ "do not convert text files" and unpack the system again.']].
+ 
+ 	SourceFiles := Array with: sources with: changes!

Item was added:
+ ----- Method: FileDirectory class>>setDefaultDirectory: (in category '*System-Files') -----
+ setDefaultDirectory: directoryName
+ 	"Initialize the default directory to the directory supplied. This method is called when the image starts up."
+ 	| dirName |
+ 	DirectoryClass := self activeDirectoryClass.
+ 	dirName := (FilePath pathName: directoryName) asSqueakPathName.
+ 	[dirName endsWith: self slash] whileTrue:[
+ 		dirName := dirName copyFrom: 1 to: dirName size - self slash size.
+ 	].
+ 	DefaultDirectory := self on: dirName.!

Item was added:
+ ----- Method: FileStream class>>fileIn: (in category '*System-Files') -----
+ fileIn: fullName
+ 	"File in the entire contents of the file specified by the name provided"
+ 
+ 	| ff |
+ 	fullName ifNil: [^ Beeper beep].
+ 	ff := self readOnlyFileNamed: (GZipReadStream uncompressedFileName: fullName).
+ 	ff fileIn.
+ !



More information about the Squeak-dev mailing list