David T. Lewis uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-dtl.1299.mcz
==================== Summary ====================
Name: System-dtl.1299
Author: dtl
Time: 2 February 2022, 8:22:57.737847 pm
UUID: 169291d9-fa07-4303-8539-6f662af6bad4
Ancestors: System-dtl.1298
Do not set the sources stream binary until after the check to verify it is streaming on a .sources file (because some streams do not understand #binary)
=============== Diff against System-dtl.1298 ===============
Item was changed:
----- Method: SmalltalkImage>>compressSources (in category 'housekeeping') -----
compressSources
"Copy all the source file to a compressed file. Usually preceded by Smalltalk condenseSources."
"The new file will be created in the default directory, and the code in openSources
will try to open it if it is there, otherwise it will look for normal sources."
"Smalltalk compressSources"
| f cfName cf |
+ f := SourceFiles first readOnlyCopy.
- f := SourceFiles first readOnlyCopy binary. "binary to preserve utf8 encoding"
(f localName endsWith: 'sources')
ifTrue: [cfName := (f localName allButLast: 7) , 'stc']
ifFalse: [self error: 'Hey, I thought the sources name ended with ''.sources''.'].
+ f binary. "binary to preserve utf8 encoding"
cf := (CompressedSourceStream on: (FileStream newFileNamed: cfName))
segmentSize: 65536 maxSize: f size.
"Copy the sources"
'Compressing Sources File...'
displayProgressFrom: 0 to: f size
during:
[:bar | f position: 0.
[f atEnd] whileFalse:
[cf nextPutAll: (f next: 65536).
bar value: f position]].
cf close.
self setMacFileInfoOn: cfName.
self inform: 'You now have a compressed sources file!!
Squeak will use it the next time you start.'!
David T. Lewis uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-dtl.1301.mcz
==================== Summary ====================
Name: System-dtl.1301
Author: dtl
Time: 2 February 2022, 8:11:46.843533 pm
UUID: 24bbff66-2d06-47fb-a3fa-4f51eeeff5d4
Ancestors: System-dtl.1298
Do not set the sources stream binary until after the check to verify it is streaming on a .sources file (because some streams do not understand #binary)
=============== Diff against System-dtl.1298 ===============
Item was changed:
----- Method: SmalltalkImage>>compressSources (in category 'housekeeping') -----
compressSources
"Copy all the source file to a compressed file. Usually preceded by Smalltalk condenseSources."
"The new file will be created in the default directory, and the code in openSources
will try to open it if it is there, otherwise it will look for normal sources."
"Smalltalk compressSources"
| f cfName cf |
+ f := SourceFiles first readOnlyCopy.
- f := SourceFiles first readOnlyCopy binary. "binary to preserve utf8 encoding"
(f localName endsWith: 'sources')
ifTrue: [cfName := (f localName allButLast: 7) , 'stc']
ifFalse: [self error: 'Hey, I thought the sources name ended with ''.sources''.'].
+ f binary. "binary to preserve utf8 encoding"
cf := (CompressedSourceStream on: (FileStream newFileNamed: cfName))
segmentSize: 65536 maxSize: f size.
"Copy the sources"
'Compressing Sources File...'
displayProgressFrom: 0 to: f size
during:
[:bar | f position: 0.
[f atEnd] whileFalse:
[cf nextPutAll: (f next: 65536).
bar value: f position]].
cf close.
self setMacFileInfoOn: cfName.
self inform: 'You now have a compressed sources file!!
Squeak will use it the next time you start.'!
David T. Lewis uploaded a new version of System to project The Treated Inbox:
http://source.squeak.org/treated/System-dtl.1277.mcz
==================== Summary ====================
Name: System-dtl.1277
Author: dtl
Time: 1 January 2022, 2:57:48.389886 pm
UUID: 4d975f20-d62d-4b7e-8abb-bc511d976834
Ancestors: System-mt.1276
Look for the sources file in well-known locations on some platforms. For Unix, if not found in the usual locations then look in /usr/share/squeak and /usr/local/share/squeak. Hooks for other platforms may be added to SmalltalkImage>>sourcesFilePaths.
Refactor to reduce duplication of logic in locateSourcesEntry and openSources:forImage: and to ensure that the full set of file paths is searched for stc compressed sources files prior to searching for regular sources files.
=============== Diff against System-mt.1276 ===============
Item was removed:
- ----- 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 removed:
- ----- 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: [Smalltalk 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 removed:
- ----- Method: FileDirectory class>>openSources:forImage: (in category '*System-Files') -----
- openSources: fullSourcesName forImage: imageName
- "We first do a check to see if a compressed version ofthe sources file is present.
- Open the .sources file read-only after searching in:
- a) the directory where the VM lives
- b) the directory where the image came from
- c) the DefaultDirectory (which is likely the same as b unless the SecurityManager has changed it).
- "
-
- | sources fd sourcesName |
- (fullSourcesName endsWith: 'sources') ifTrue:
- ["Look first for a sources file in compressed format."
- sources := self openSources: (fullSourcesName allButLast: 7) , 'stc'
- forImage: imageName.
- sources ifNotNil: [^ CompressedSourceStream on: sources]].
-
- sourcesName := FileDirectory localNameFor: fullSourcesName.
- "look for the sources file or an alias to it in the VM's directory"
- fd := FileDirectory on: Smalltalk vmPath.
- (fd fileExists: sourcesName)
- ifTrue: [sources := fd readOnlyFileNamed: sourcesName].
- sources ifNotNil: [^ sources].
- "look for the sources file or an alias to it in the image directory"
- fd := FileDirectory on: (FileDirectory dirPathFor: imageName).
- (fd fileExists: sourcesName)
- ifTrue: [sources := fd readOnlyFileNamed: sourcesName].
- sources ifNotNil: [^ sources].
- "look for the sources in the current directory"
- fd := DefaultDirectory.
- (fd fileExists: sourcesName)
- ifTrue: [sources := fd readOnlyFileNamed: sourcesName].
- "sources may still be nil here"
- ^sources
- !
Item was removed:
- ----- Method: SmalltalkImage>>locateSourcesEntry (in category 'image, changes names') -----
- locateSourcesEntry
- | sourcesFilename |
- sourcesFilename := SourceFileVersionString , FileDirectory dot , 'sources'.
- ^ {Smalltalk vmPath.
- FileDirectory default fullName, FileDirectory slash}
- detect: [ : each | (each , sourcesFilename) asDirectoryEntry notNil ]
- ifFound: [ : foundPath | (foundPath , sourcesFilename) asDirectoryEntry ]
- ifNone: [ nil ]!
Item was added:
+ ----- Method: SmalltalkImage>>locateSourcesEntry: (in category 'image, changes names') -----
+ locateSourcesEntry: sourcesFilename
+ "Locate sources file entry, looking first in the VM path directory, then in the image
+ directory, and finally in some well-known locations for various OS platforms"
+
+ ^ self sourcesFilePaths
+ detect: [ : each | (each , sourcesFilename) asDirectoryEntry notNil ]
+ ifFound: [ : foundPath | (foundPath , sourcesFilename) asDirectoryEntry ]
+ ifNone: [ nil ]!
Item was added:
+ ----- Method: SmalltalkImage>>openChanges:forImage: (in category 'image, changes names') -----
+ 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 := FileDirectory default.
+ (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 := FileDirectory default.
+ (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 changed:
----- Method: SmalltalkImage>>openSourceFiles (in category 'sources, changes log') -----
openSourceFiles
-
self imageName = LastImageName ifFalse:
["Reset the author initials to blank when the image gets moved"
LastImageName := self imageName.
Utilities authorInitials: ''].
+ self
+ openSourcesAndChanges: self changesName
- FileDirectory
- openSources: self sourcesName
- andChanges: self changesName
forImage: LastImageName.
SourceFileArray install!
Item was added:
+ ----- Method: SmalltalkImage>>openSources (in category 'image, changes names') -----
+ openSources
+ "Open a sources file from one of several possible locations. Check first for
+ a compressed sources file and use that if available."
+
+ (self locateSourcesEntry: self sourcesCompressedFileName)
+ ifNotNil: [ :entry | ^ CompressedSourceStream on: entry readStream ].
+ (self locateSourcesEntry: self sourcesFileName)
+ ifNotNil: [ :entry | ^ entry readStream ].
+ ^nil.
+ !
Item was added:
+ ----- Method: SmalltalkImage>>openSourcesAndChanges:forImage: (in category 'image, changes names') -----
+ openSourcesAndChanges: 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 := Smalltalk openSources.
+ changes := Smalltalk openChanges: changesName forImage: imageName.
+
+ ((sources == nil or: [sources atEnd])
+ and: [Preferences valueOfFlag: #warnIfNoSourcesFile])
+ ifTrue: [Smalltalk 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 ' , self 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: SmalltalkImage>>sourcesCompressedFileName (in category 'image, changes names') -----
+ sourcesCompressedFileName
+ ^SourceFileVersionString , FileDirectory dot, 'stc'
+ !
Item was added:
+ ----- Method: SmalltalkImage>>sourcesFileName (in category 'image, changes names') -----
+ sourcesFileName
+ ^SourceFileVersionString , FileDirectory dot , 'sources'
+ !
Item was added:
+ ----- Method: SmalltalkImage>>sourcesFilePaths (in category 'image, changes names') -----
+ sourcesFilePaths
+ "A list of likely locations for the sources file. Look first in the VM path directory, then
+ in the image directory, and finally in some well-known locations for this OS platform"
+
+ | paths vmPath imagePath defaultPath |
+ paths := OrderedCollection new.
+ paths add: (vmPath := self vmPath).
+ paths add: (imagePath := self imagePath, FileDirectory slash).
+ imagePath = (defaultPath := FileDirectory default fullName, FileDirectory slash)
+ ifFalse: ["imagePath and defaultPath are usually the same"
+ paths add: defaultPath].
+ ('/usr/*/lib/*' match: vmPath)
+ ifTrue: ["Unix platform with VM installed in system directories"
+ paths
+ add: '/usr/share/squeak/';
+ add: '/usr/local/share/squeak/' ].
+ "Well known paths for other platform types may be added here"
+
+ ^paths
+ !
Item was changed:
----- Method: SmalltalkImage>>sourcesName (in category 'image, changes names') -----
sourcesName
"Answer the full path to the version-stable source code if it exists, otherwise the desired location"
+ ^ (self locateSourcesEntry: self sourcesFileName)
+ ifNil: [ self vmPath , self sourcesFileName ]
- ^ self locateSourcesEntry
- ifNil: [ self vmPath , SourceFileVersionString , FileDirectory dot , 'sources' ]
ifNotNil: [ : entry | entry fullName ]!
David T. Lewis uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-dtl.1298.mcz
==================== Summary ====================
Name: System-dtl.1298
Author: dtl
Time: 2 February 2022, 7:44:42.546288 pm
UUID: 1bfeaec9-efde-4cea-a17a-19f6b1844306
Ancestors: System-ct.1297
For opening the sources file, reduce duplication of logic in locateSourcesEntry and openSources:forImage: and ensure that the full set of file paths is searched for stc compressed sources files prior to searching for regular sources files.
Also search for the sources file in well-known locations on some platforms. For Unix, if not found in the usual locations then look in /usr/share/squeak and /usr/local/share/squeak. Hooks for other platforms may be added to SmalltalkImage>>sourcesFilePaths, but may require VM support to identify suitable paths.
=============== Diff against System-ct.1297 ===============
Item was removed:
- ----- 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 removed:
- ----- 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.
- sources ifNotNil: [sources setConverterForCode].
- changes := self openChanges: changesName forImage: imageName.
- changes ifNotNil: [changes setConverterForCode].
-
- ((sources == nil or: [sources atEnd])
- and: [Preferences valueOfFlag: #warnIfNoSourcesFile])
- ifTrue: [Smalltalk 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 removed:
- ----- Method: FileDirectory class>>openSources:forImage: (in category '*System-Files') -----
- openSources: fullSourcesName forImage: imageName
- "We first do a check to see if a compressed version ofthe sources file is present.
- Open the .sources file read-only after searching in:
- a) the directory where the VM lives
- b) the directory where the image came from
- c) the DefaultDirectory (which is likely the same as b unless the SecurityManager has changed it).
- "
-
- | sources fd sourcesName |
- (fullSourcesName endsWith: 'sources') ifTrue:
- ["Look first for a sources file in compressed format."
- sources := self openSources: (fullSourcesName allButLast: 7) , 'stc'
- forImage: imageName.
- sources ifNotNil: [^ CompressedSourceStream on: sources]].
-
- sourcesName := FileDirectory localNameFor: fullSourcesName.
- "look for the sources file or an alias to it in the VM's directory"
- fd := FileDirectory on: Smalltalk vmPath.
- (fd fileExists: sourcesName)
- ifTrue: [sources := fd readOnlyFileNamed: sourcesName].
- sources ifNotNil: [^ sources].
- "look for the sources file or an alias to it in the image directory"
- fd := FileDirectory on: (FileDirectory dirPathFor: imageName).
- (fd fileExists: sourcesName)
- ifTrue: [sources := fd readOnlyFileNamed: sourcesName].
- sources ifNotNil: [^ sources].
- "look for the sources in the current directory"
- fd := DefaultDirectory.
- (fd fileExists: sourcesName)
- ifTrue: [sources := fd readOnlyFileNamed: sourcesName].
- "sources may still be nil here"
- ^sources
- !
Item was changed:
----- Method: SmalltalkImage>>locateSourcesEntry (in category 'image, changes names') -----
locateSourcesEntry
+ ^self locateSourcesEntry: self sourcesFileName.!
- | sourcesFilename |
- sourcesFilename := SourceFileVersionString , FileDirectory dot , 'sources'.
- ^ {Smalltalk vmPath.
- FileDirectory default fullName, FileDirectory slash}
- detect: [ : each | (each , sourcesFilename) asDirectoryEntry notNil ]
- ifFound: [ : foundPath | (foundPath , sourcesFilename) asDirectoryEntry ]
- ifNone: [ nil ]!
Item was added:
+ ----- Method: SmalltalkImage>>locateSourcesEntry: (in category 'image, changes names') -----
+ locateSourcesEntry: sourcesFilename
+ "Locate sources file entry, looking first in the VM path directory, then in the image
+ directory, and finally in some well-known locations for various OS platforms"
+
+ ^ self sourcesFilePaths
+ detect: [ : each | (each , sourcesFilename) asDirectoryEntry notNil ]
+ ifFound: [ : foundPath | (foundPath , sourcesFilename) asDirectoryEntry ]
+ ifNone: [ nil ]!
Item was added:
+ ----- Method: SmalltalkImage>>openChanges:forImage: (in category 'image, changes names') -----
+ 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 := FileDirectory default.
+ (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 := FileDirectory default.
+ (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 changed:
----- Method: SmalltalkImage>>openSourceFiles (in category 'sources, changes log') -----
openSourceFiles
-
self imageName = LastImageName ifFalse:
["Reset the author initials to blank when the image gets moved"
LastImageName := self imageName.
Utilities authorInitials: ''].
+ self
+ openSourcesAndChanges: self changesName
- FileDirectory
- openSources: self sourcesName
- andChanges: self changesName
forImage: LastImageName.
SourceFileArray install!
Item was added:
+ ----- Method: SmalltalkImage>>openSources (in category 'image, changes names') -----
+ openSources
+ "Open a sources file from one of several possible locations. Check first for
+ a compressed sources file and use that if available."
+
+ (self classNamed: #CompressedSources)
+ ifNotNil: [ :cls | cls cachedSources
+ ifNotNil: [ :src | ^src ]].
+ (self locateSourcesEntry: self sourcesCompressedFileName)
+ ifNotNil: [ :entry | ^ CompressedSourceStream on: entry readStream ].
+ (self locateSourcesEntry: self sourcesFileName)
+ ifNotNil: [ :entry | ^ entry readStream ].
+ ^nil.
+ !
Item was added:
+ ----- Method: SmalltalkImage>>openSourcesAndChanges:forImage: (in category 'image, changes names') -----
+ openSourcesAndChanges: 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 := Smalltalk openSources.
+ sources ifNotNil: [sources setConverterForCode].
+ changes := Smalltalk openChanges: changesName forImage: imageName.
+ changes ifNotNil: [changes setConverterForCode].
+
+ ((sources == nil or: [sources atEnd])
+ and: [Preferences valueOfFlag: #warnIfNoSourcesFile])
+ ifTrue: [Smalltalk 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 ' , self 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: SmalltalkImage>>sourcesCompressedFileName (in category 'image, changes names') -----
+ sourcesCompressedFileName
+ ^SourceFileVersionString , FileDirectory dot, 'stc'
+ !
Item was added:
+ ----- Method: SmalltalkImage>>sourcesFileName (in category 'image, changes names') -----
+ sourcesFileName
+ ^SourceFileVersionString , FileDirectory dot , 'sources'
+ !
Item was added:
+ ----- Method: SmalltalkImage>>sourcesFilePaths (in category 'image, changes names') -----
+ sourcesFilePaths
+ "A list of likely locations for the sources file. Look first in the VM path directory, then
+ in the image directory, and finally in some well-known locations for this OS platform"
+
+ | paths vmPath imagePath defaultPath |
+ paths := OrderedCollection new.
+ paths add: (vmPath := self vmPath).
+ paths add: (imagePath := self imagePath, FileDirectory slash).
+ imagePath = (defaultPath := FileDirectory default fullName, FileDirectory slash)
+ ifFalse: ["imagePath and defaultPath are usually the same"
+ paths add: defaultPath].
+ ('/usr/*/lib/*' match: vmPath)
+ ifTrue: ["Unix platform with VM installed in system directories"
+ paths
+ add: '/usr/share/squeak/';
+ add: '/usr/local/share/squeak/' ].
+ "Well known paths for other platform types may be added here"
+
+ ^paths
+ !
Item was changed:
----- Method: SmalltalkImage>>sourcesName (in category 'image, changes names') -----
sourcesName
"Answer the full path to the version-stable source code if it exists, otherwise the desired location"
^ self locateSourcesEntry
+ ifNil: [ self vmPath , self sourcesFileName ]
- ifNil: [ self vmPath , SourceFileVersionString , FileDirectory dot , 'sources' ]
ifNotNil: [ : entry | entry fullName ]!
Chris Muller uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-cmm.985.mcz
==================== Summary ====================
Name: Collections-cmm.985
Author: cmm
Time: 2 February 2022, 3:56:57.307776 pm
UUID: 665d5e7b-a80a-41b1-bad8-4f3c6cfa866c
Ancestors: Collections-cmm.984
Forgot to delete the override in cmm.984.
=============== Diff against Collections-cmm.984 ===============
Item was removed:
- ----- Method: OrderedDictionary>>= (in category 'comparing') -----
- = anObject
- "Two ordered dictionaries are equal if
- (a) they are the same 'kind' of thing.
- (b) they have the same set of keys in the same order.
- (c) for each (common) key, they have the same value"
-
- self == anObject ifTrue: [ ^true ].
- self species == anObject species ifFalse: [ ^false ].
- self size = anObject size ifFalse: [ ^false ].
- self keys = anObject keys ifFalse: [ ^false].
- self associationsDo: [ :association |
- (anObject at: association key ifAbsent: [ ^false ]) = association value
- ifFalse: [ ^false ] ].
- ^true!
Chris Muller uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-cmm.984.mcz
==================== Summary ====================
Name: Collections-cmm.984
Author: cmm
Time: 2 February 2022, 3:54:20.944662 pm
UUID: 88a7a4ca-9648-4dce-bb89-f9c857baec29
Ancestors: Collections-mt.983
- Avoid unnecessary garbage in #= for OrderedDictionary comparisons.
- Delegate #species comparison via #=.
- #hasEqualElements: API compatibility with SequenceableCollection.
=============== Diff against Collections-mt.983 ===============
Item was added:
+ ----- Method: OrderedDictionary>>hasEqualElements: (in category 'comparing') -----
+ hasEqualElements: anOrderedDictionary
+ "Answer whether my elements are the same as anOrderedDictionary, and in the same order."
+ | index |
+ self size = anOrderedDictionary size ifFalse: [ ^ false ].
+ index := 0.
+ self associationsDo:
+ [ : eachMyAssociation |
+ (anOrderedDictionary
+ atIndex: (index:=index+1)
+ ifAbsent: [ ^ false ]) = eachMyAssociation ifFalse: [ ^ false ] ].
+ ^ true!
Item was changed:
----- Method: PluggableDictionary>>= (in category 'comparing') -----
= anObject
"Two dictionaries are equal if
(a) they are the same 'kind' of thing.
(b) they have the same set of keys.
(c) for each (common) key, they have the same value"
self == anObject ifTrue: [ ^true ].
+ self species = anObject species ifFalse: [ ^false ].
- self species == anObject species ifFalse: [ ^false ].
hashBlock = anObject hashBlock ifFalse: [ ^false ].
equalBlock = anObject equalBlock ifFalse: [ ^false ].
+ ^ self hasEqualElements: anObject!
- self size = anObject size ifFalse: [ ^false ].
- self associationsDo: [ :association |
- (anObject at: association key ifAbsent: [ ^false ]) = association value
- ifFalse: [ ^false ] ].
- ^true!
Item was added:
+ ----- Method: PluggableDictionary>>hasEqualElements: (in category 'comparing') -----
+ hasEqualElements: aDictionary
+ "Answer whether my elements are the same as those of aDictionary."
+ self size = aDictionary size ifFalse: [ ^ false ].
+ self associationsDo:
+ [ : association |
+ (aDictionary
+ at: association key
+ ifAbsent: [ ^ false ]) = association value ifFalse: [ ^ false ] ].
+ ^ true!
Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.983.mcz
==================== Summary ====================
Name: Collections-mt.983
Author: mt
Time: 2 February 2022, 8:53:50.38038 pm
UUID: 88b21e56-cd5d-6c4e-b4b1-03d25fb1d2ea
Ancestors: Collections-ct.982
Fixes comparison of OrderedDictionary. Thanks to Christian Haider for reporting it!
Does it make sense to call super? Or is it better to compare keys before comparing values?
=============== Diff against Collections-ct.982 ===============
Item was added:
+ ----- Method: OrderedDictionary>>= (in category 'comparing') -----
+ = anObject
+ "Two ordered dictionaries are equal if
+ (a) they are the same 'kind' of thing.
+ (b) they have the same set of keys in the same order.
+ (c) for each (common) key, they have the same value"
+
+ self == anObject ifTrue: [ ^true ].
+ self species == anObject species ifFalse: [ ^false ].
+ self size = anObject size ifFalse: [ ^false ].
+ self keys = anObject keys ifFalse: [ ^false].
+ self associationsDo: [ :association |
+ (anObject at: association key ifAbsent: [ ^false ]) = association value
+ ifFalse: [ ^false ] ].
+ ^true!
David T. Lewis uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-dtl.262.mcz
==================== Summary ====================
Name: Multilingual-dtl.262
Author: dtl
Time: 31 January 2022, 7:45:20.779281 pm
UUID: e60348fe-c771-4c52-a591-0769dbf29a58
Ancestors: Multilingual-mt.261
Move FileStream>>setConverterForCode up to ReadWriteStream for opening CompressedSourceStream on a .stc compressed sources file.
=============== Diff against Multilingual-mt.261 ===============
Item was removed:
- ----- Method: FileStream>>setConverterForCode (in category '*Multilingual-accessing') -----
- setConverterForCode
- "Backstop. See MultiByteFileStream."!
Item was added:
+ ----- Method: ReadWriteStream>>setConverterForCode (in category '*Multilingual-accessing') -----
+ setConverterForCode
+ "Backstop. See MultiByteFileStream."!