changed: #changesStream
authorStefan Vogel <sv@exept.de>
Thu, 05 Apr 2012 12:12:26 +0200
changeset 14096 69bc1ebf0477
parent 14095 73651b01bf12
child 14097 d8fc9697dd23
changed: #changesStream open change file only once when writing a change
ClassDescription.st
--- a/ClassDescription.st	Thu Apr 05 12:01:32 2012 +0200
+++ b/ClassDescription.st	Thu Apr 05 12:12:26 2012 +0200
@@ -820,7 +820,6 @@
     "Created: / 28.3.1998 / 21:21:52 / cg"
 ! !
 
-
 !ClassDescription methodsFor:'Compatibility-V''Age'!
 
 categoriesFor:aSelector are:listOfCategories
@@ -1492,24 +1491,23 @@
         streamType := FileStream.
     ].
 
-    "/ changeFileIsNew := fileName asFilename exists not or:[fileName asFilename fileSize = 0].
-    changeFileIsNew := (fileName asFilename fileSize ? 0) = 0.
-    changeFileIsNew ifTrue:[
-        encoder := CharacterEncoder encoderForUTF8.
-    ] ifFalse:[
-        encoding := CharacterEncoder guessEncodingOfFile:fileName.
-        encoding isNil ifTrue:[
-            encoding := #'iso8859-1'.
-        ].
-        encoder := CharacterEncoder encoderFor:encoding.
-    ].
-
     [
         changesStream := streamType fileNamed:fileName.
     ] on:FileStream openErrorSignal do:[:ex|
         self warn:'cannot create/update the changes file (check permissions)'.
         ^ nil
     ].
+
+    changeFileIsNew := changesStream fileSize = 0.
+    changeFileIsNew ifTrue:[
+        encoder := CharacterEncoder encoderForUTF8.
+    ] ifFalse:[
+        encoding := CharacterEncoder guessEncodingOfStream:changesStream.
+        encoding isNil ifTrue:[
+            encoding := #'iso8859-1'.
+        ].
+        encoder := CharacterEncoder encoderFor:encoding.
+    ].
     changesStream setToEnd.
 
     changesStream := EncodedStream stream:changesStream encoder:encoder.
@@ -4214,11 +4212,11 @@
 !ClassDescription class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.222 2012-01-31 12:58:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.223 2012-04-05 10:12:26 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.222 2012-01-31 12:58:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.223 2012-04-05 10:12:26 stefan Exp $'
 ! !
 
 ClassDescription initialize!