#BUGFIX
class: ObjectMemory
changed: #nameForChanges
for compatibility, return a string
--- a/ObjectMemory.st Thu Oct 29 09:26:57 2015 +0100
+++ b/ObjectMemory.st Thu Oct 29 11:33:21 2015 +0100
@@ -1,16 +1,3 @@
-"{ Encoding: utf8 }"
-
-"
- COPYRIGHT (c) 1992 by Claus Gittinger
- All Rights Reserved
-
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice. This software may not
- be provided or otherwise made available to, or used by, any
- other person. No title to or ownership of the software is
- hereby transferred.
-"
"{ Package: 'stx:libbasic' }"
"{ NameSpace: Smalltalk }"
@@ -5560,10 +5547,12 @@
!
nameForChanges
- "return a reasonable filename to store the changes into.
+ "return a reasonable filename string to store the changes into.
By default, this is the basename of the current image with '.img' replaced
by '.chg', or, if not running from an image, the default name 'st.chg'.
- However, it can be overwritten via the nameForChanges: setter"
+ However, it can be overwritten via the nameForChanges: setter.
+ For now, this returns a string (for backward compatibility);
+ senders should be prepared to get a filename in the future."
|userPrefs localName nm wd|
@@ -5571,17 +5560,20 @@
userPrefs := UserPreferences current.
"/ if the prefs provide a full, explicit name
- (nm := userPrefs changeFileName) notNil ifTrue:[ ^ nm ].
-
- "/ if there is a workspace, create it there
- ((wd := userPrefs workspaceDirectory) notNil and:[wd exists]) ifTrue:[
- ^ wd / (localName asFilename baseName)
- ].
-
- "/ if it was set by a startup file
- ChangeFileName notNil ifTrue:[^ ChangeFileName].
- "/ finally, fall back to a default.
- ^ localName
+ (nm := userPrefs changeFileName) isNil ifTrue:[
+
+ "/ if there is a workspace, create it there
+ ((wd := userPrefs workspaceDirectory) notNil and:[wd exists]) ifTrue:[
+ nm := wd / (localName asFilename baseName)
+ ] ifFalse:[
+ "/ if it was set by a startup file
+ (nm := ChangeFileName) isNil ifTrue:[
+ "/ finally, fall back to a default.
+ nm := localName
+ ]
+ ]
+ ].
+ ^ nm asFilename pathName.
"
ObjectMemory nameForChanges