#DOCUMENTATION
class: ObjectMemory
comment/format in:
#snapShot
#snapShotOn:
#snapShotOn:setImageName:
--- a/ObjectMemory.st Wed Oct 28 18:26:56 2015 +0100
+++ b/ObjectMemory.st Wed Oct 28 18:31:21 2015 +0100
@@ -5693,7 +5693,7 @@
snapShot
"create a snapshot file containing all of the current state."
- self snapShotOn:self nameForSnapshot setImageName:true
+ self snapShotOn:(self nameForSnapshot) setImageName:true
"
ObjectMemory snapShot
@@ -5701,6 +5701,8 @@
!
snapShotOn:aFileName
+ "create a snapshot file containing all of the current state."
+
^ self snapShotOn:aFileName setImageName:true.
"
@@ -5729,7 +5731,7 @@
ST-80 compatibility; send #preSnapshot to all classes
"
Smalltalk allClassesDo:[:aClass |
- aClass preSnapshot
+ aClass preSnapshot
].
"
@@ -5739,58 +5741,55 @@
"
snapshotFilename := aFileName asFilename.
snapshotFilename isAbsolute ifFalse:[
- snapshotFilename := self directoryForImageAndChangeFile
- / snapshotFilename name.
+ snapshotFilename := self directoryForImageAndChangeFile
+ / snapshotFilename name.
].
tempFilename := (FileStream newTemporaryIn:snapshotFilename directory)
- close;
- fileName.
+ close;
+ fileName.
ok := self primSnapShotOn:tempFilename.
ok ifTrue:[
- "keep history of one snapshot file"
- snapshotFilename exists ifTrue:[
- tempFilename symbolicAccessRights:snapshotFilename symbolicAccessRights.
- snapshotFilename renameTo:(snapshotFilename withSuffix:'sav').
- ] ifFalse:[
- "image file hat stx as interpreter and can be executed"
- tempFilename makeExecutable.
- ].
- tempFilename renameTo:snapshotFilename.
-
- Class addChangeRecordForSnapshot:aFileName.
-
- setImageName ifTrue:[
- oldChangeFile := self nameForChanges.
- ImageName := snapshotFilename asAbsoluteFilename asString.
- self refreshChangesFrom:oldChangeFile.
- ].
+ "keep history of one snapshot file"
+ snapshotFilename exists ifTrue:[
+ tempFilename symbolicAccessRights:snapshotFilename symbolicAccessRights.
+ snapshotFilename renameTo:(snapshotFilename withSuffix:'sav').
+ ] ifFalse:[
+ "image file hat stx as interpreter and can be executed"
+ tempFilename makeExecutable.
+ ].
+ tempFilename renameTo:snapshotFilename.
+
+ Class addChangeRecordForSnapshot:aFileName.
+
+ setImageName ifTrue:[
+ oldChangeFile := self nameForChanges.
+ ImageName := snapshotFilename asAbsoluteFilename asString.
+ self refreshChangesFrom:oldChangeFile.
+ ].
] ifFalse:[
- tempFilename remove.
+ tempFilename remove.
].
"
ST-80 compatibility; send #postSnapshot to all classes
"
Smalltalk allClassesDo:[:aClass |
- aClass postSnapshot
+ aClass postSnapshot
].
self changed:#finishedSnapshot. "/ ST-80 compatibility
ok ifFalse:[
- SnapshotError raise.
- "not reached"
+ SnapshotError raise.
+ "not reached"
].
Transcript
- show:'Snapshot ';
- show:snapshotFilename baseName allBold;
- show:' saved ';
- show:Timestamp now;
- show:' in ';
- show:snapshotFilename asAbsoluteFilename directoryName;
- showCR:'.'.
+ show:'Snapshot '; show:snapshotFilename baseName allBold;
+ show:' saved '; show:Timestamp now;
+ show:' in '; show:snapshotFilename asAbsoluteFilename directoryName;
+ showCR:'.'.
^ ok