Class.st
changeset 15331 e333425b391e
parent 15308 59bed280c457
child 15466 922e035d4fde
child 18066 89d51443ba6f
--- a/Class.st	Mon May 27 10:23:00 2013 +0200
+++ b/Class.st	Mon May 27 10:45:38 2013 +0200
@@ -1808,6 +1808,7 @@
     "Created: / 18-07-2011 / 09:14:38 / cg"
 ! !
 
+
 !Class methodsFor:'adding & removing'!
 
 removeFromSystem
@@ -2417,9 +2418,9 @@
      mySourceFileName sameFile s mySourceFileID anySourceRef|
 
     self isLoaded ifFalse:[
-	^ FileOutErrorSignal
-	    raiseRequestWith:self
-		 errorString:' - will not fileOut unloaded class: ', self name
+        ^ FileOutErrorSignal
+            raiseRequestWith:self
+                 errorString:' - will not fileOut unloaded class: ', self name
     ].
 
     fileName := fileNameString asFilename.
@@ -2430,94 +2431,94 @@
      and, if that worked rename afterwards ...
     "
     (fileName exists) ifTrue:[
-	sameFile := false.
-
-	"/ check carefully - maybe, my source does not really come from that
-	"/ file (i.e. all of my methods have their source as string)
-
-	anySourceRef := false.
-	self instAndClassMethodsDo:[:m |
-	    m sourcePosition notNil ifTrue:[
-		anySourceRef := true
-	    ]
-	].
-
-	anySourceRef ifTrue:[
-	    s := self sourceStream.
-	    s notNil ifTrue:[
-		OperatingSystem isUNIXlike ifTrue:[
-		    mySourceFileID := s pathName asFilename info id.
-		    sameFile := (fileName info id) == mySourceFileID.
-		] ifFalse:[
-		    mySourceFileID := s pathName asFilename asAbsoluteFilename.
-		    sameFile := (fileName asFilename asAbsoluteFilename) = mySourceFileID.
-		].
-		s close.
-	    ] ifFalse:[
-		classFilename notNil ifTrue:[
-		    "
-		     check for overwriting my current source file
-		     this is not allowed, since it would clobber my methods source
-		     file ... you have to save it to some other place.
-		     This happens if you ask for a fileOut into the source-directory
-		     (from which my methods get their source)
-		    "
-		    mySourceFileName := Smalltalk getSourceFileName:classFilename.
-		    sameFile := (fileNameString = mySourceFileName).
-		    sameFile ifFalse:[
-			mySourceFileName notNil ifTrue:[
-			    OperatingSystem isUNIXlike ifTrue:[
-				sameFile := (fileName info id) == (mySourceFileName asFilename info id)
-			    ]
-			]
-		    ].
-		]
-	    ].
-	].
-
-	sameFile ifTrue:[
-	    ^ FileOutErrorSignal
-		raiseRequestWith:fileNameString
-		errorString:(' - may not overwrite sourcefile:', fileNameString)
-	].
-
-	savFilename := Filename newTemporary.
-	fileName copyTo:savFilename.
-	newFileName := fileName withSuffix:'new'.
-	needRename := true
+        sameFile := false.
+
+        "/ check carefully - maybe, my source does not really come from that
+        "/ file (i.e. all of my methods have their source as string)
+
+        anySourceRef := false.
+        self instAndClassMethodsDo:[:m |
+            m sourcePosition notNil ifTrue:[
+                anySourceRef := true
+            ]
+        ].
+
+        anySourceRef ifTrue:[
+            s := self sourceStream.
+            s notNil ifTrue:[
+                OperatingSystem isUNIXlike ifTrue:[
+                    mySourceFileID := s pathName asFilename info id.
+                    sameFile := (fileName info id) == mySourceFileID.
+                ] ifFalse:[
+                    mySourceFileID := s pathName asFilename asAbsoluteFilename.
+                    sameFile := (fileName asFilename asAbsoluteFilename) = mySourceFileID.
+                ].
+                s close.
+            ] ifFalse:[
+                classFilename notNil ifTrue:[
+                    "
+                     check for overwriting my current source file
+                     this is not allowed, since it would clobber my methods source
+                     file ... you have to save it to some other place.
+                     This happens if you ask for a fileOut into the source-directory
+                     (from which my methods get their source)
+                    "
+                    mySourceFileName := Smalltalk getSourceFileName:classFilename.
+                    sameFile := (fileNameString = mySourceFileName).
+                    sameFile ifFalse:[
+                        mySourceFileName notNil ifTrue:[
+                            OperatingSystem isUNIXlike ifTrue:[
+                                sameFile := (fileName info id) == (mySourceFileName asFilename info id)
+                            ]
+                        ]
+                    ].
+                ]
+            ].
+        ].
+
+        sameFile ifTrue:[
+            ^ FileOutErrorSignal
+                raiseRequestWith:fileNameString
+                errorString:(' - may not overwrite sourcefile: %1\try again after loading sources in the browser' withCRs bindWith:fileNameString)
+        ].
+
+        savFilename := Filename newTemporary.
+        fileName copyTo:savFilename.
+        newFileName := fileName withSuffix:'new'.
+        needRename := true
     ] ifFalse:[
-	"/ another possible trap: if my sourceFileName is
-	"/ the same as the written one AND the new files directory
-	"/ is along the sourcePath, we also need a temporary file
-	"/ first, to avoid accessing the newly written file.
-
-	anySourceRef := false.
-	self instAndClassMethodsDo:[:m |
-	    |mSrc|
-
-	    (mSrc := m sourceFilename) notNil ifTrue:[
-		mSrc asFilename baseName = fileName baseName ifTrue:[
-		    anySourceRef := true
-		]
-	    ]
-	].
-	anySourceRef ifTrue:[
-	    newFileName := fileName withSuffix:'new'.
-	    needRename := true
-	] ifFalse:[
-	    newFileName := fileName.
-	    needRename := false
-	]
+        "/ another possible trap: if my sourceFileName is
+        "/ the same as the written one AND the new files directory
+        "/ is along the sourcePath, we also need a temporary file
+        "/ first, to avoid accessing the newly written file.
+
+        anySourceRef := false.
+        self instAndClassMethodsDo:[:m |
+            |mSrc|
+
+            (mSrc := m sourceFilename) notNil ifTrue:[
+                mSrc asFilename baseName = fileName baseName ifTrue:[
+                    anySourceRef := true
+                ]
+            ]
+        ].
+        anySourceRef ifTrue:[
+            newFileName := fileName withSuffix:'new'.
+            needRename := true
+        ] ifFalse:[
+            newFileName := fileName.
+            needRename := false
+        ]
     ].
     [
-	aStream := newFileName writeStream.
+        aStream := newFileName writeStream.
     ] on:FileStream openErrorSignal do:[:ex|
-	savFilename notNil ifTrue:[
-	    savFilename delete
-	].
-	^ FileOutErrorSignal
-		raiseRequestWith:newFileName name
-		errorString:(' - cannot create file:', newFileName name)
+        savFilename notNil ifTrue:[
+            savFilename delete
+        ].
+        ^ FileOutErrorSignal
+                raiseRequestWith:newFileName name
+                errorString:(' - cannot create file:', newFileName name)
     ].
     self fileOutOn:aStream.
     aStream close.
@@ -2528,11 +2529,11 @@
      we have to do a copy ...
     "
     needRename ifTrue:[
-	newFileName copyTo:fileName.
-	newFileName delete
+        newFileName copyTo:fileName.
+        newFileName delete
     ].
     savFilename notNil ifTrue:[
-	savFilename delete
+        savFilename delete
     ].
 
     "
@@ -5551,11 +5552,11 @@
 !Class class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.625 2013-05-16 23:41:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.626 2013-05-27 08:45:38 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.625 2013-05-16 23:41:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.626 2013-05-27 08:45:38 cg Exp $'
 !
 
 version_SVN