diff -r a2fc58d24e2c -r f5cf1f8f16f1 AbstractLauncherApplication.st --- a/AbstractLauncherApplication.st Mon Jul 17 12:23:28 2017 +0200 +++ b/AbstractLauncherApplication.st Mon Jul 17 12:23:43 2017 +0200 @@ -485,6 +485,52 @@ ]. "Modified: / 17-07-2017 / 10:14:09 / cg" +! + +snapshotAndExit + "saves a snapshot image and exits, after asking for a fileName" + + |fileName ok| + + fileName := DialogBox + request:(resources at:'filename for image:') withCRs + initialAnswer:(ObjectMemory nameForSnapshot) + okLabel:(resources at:'save & exit') + title:(resources string:'save image & exit') + onCancel:nil. + + fileName notNil ifTrue:[ + self showCursor:Cursor write. + [ + ok := ObjectMemory snapShotOn:fileName. + ] ensure:[ + self restoreCursors. + ]. + + ok ifFalse:[ + " + snapshot failed for some reason (disk full, no permission etc.) + Do NOT exit in this case. + " + self warn:(resources string:'failed to save snapshot image (disk full or not writable)'). + ] ifTrue:[ + " + saveAllViews tells all views to shutdown neatly + (i.e. offer a chance to save the contents to a file). + + This is NOT required - all data should be in the snapshot ... + ... however, if remote disks/mountable filesystems are involved, + which may not be present the next time, it may make sense to + uncomment it and query for saving - time will show which is better. + " +" + self saveAllViews. +" + Smalltalk exit + ] + ]. + + "Modified: / 17-07-2017 / 10:43:22 / cg" ! ! !AbstractLauncherApplication methodsFor:'drag & drop'!