ChangesBrowser.st
changeset 1264 6d8f690883f1
parent 1246 9ed3722bd2f2
child 1275 b370370cf48c
--- a/ChangesBrowser.st	Thu Jul 31 17:07:18 1997 +0200
+++ b/ChangesBrowser.st	Thu Jul 31 18:55:15 1997 +0200
@@ -1723,51 +1723,58 @@
         |excla sawExcla done chunk
          nChanges "{Class:SmallInteger}" |
 
-        excla := inStream class chunkSeparator.
-        nChanges := self numberOfChanges.
-
-        1 to:nChanges do:[:index |
-            inStream position:(changePositions at:index).
-            sawExcla := inStream peekFor:excla.
-            chunk := inStream nextChunk.
-            (stamp := changeTimeStamps at:index) notNil ifTrue:[
-                outStream nextPutAll:'''---- timestamp ' , stamp , ' ----'''.
-                outStream nextPut:excla; cr.
+        Stream writeErrorSignal handle:[:ex |
+            self warn:('could not update the changes file.\\' , ex errorString) withCRs.
+            ^ false
+        ] do:[
+
+            excla := inStream class chunkSeparator.
+            nChanges := self numberOfChanges.
+
+            1 to:nChanges do:[:index |
+                inStream position:(changePositions at:index).
+                sawExcla := inStream peekFor:excla.
+                chunk := inStream nextChunk.
+                (stamp := changeTimeStamps at:index) notNil ifTrue:[
+                    outStream nextPutAll:'''---- timestamp ' , stamp , ' ----'''.
+                    outStream nextPut:excla; cr.
+                ].
+
+                sawExcla ifTrue:[
+                    outStream nextPut:excla.
+                    outStream nextChunkPut:chunk.
+                    outStream cr.
+                    "
+                     a method-definition chunk - skip followups
+                    "
+                    done := false.
+                    [done] whileFalse:[
+                        chunk := inStream nextChunk.
+                        chunk isNil ifTrue:[
+                            done := true
+                        ] ifFalse:[
+                            outStream nextChunkPut:chunk.
+                            outStream cr.
+                            done := chunk isEmpty
+                        ]
+                    ].
+                ] ifFalse:[
+                    outStream nextChunkPut:chunk.
+                    outStream cr
+                ]
             ].
-
-            sawExcla ifTrue:[
-                outStream nextPut:excla.
-                outStream nextChunkPut:chunk.
-                outStream cr.
-                "
-                 a method-definition chunk - skip followups
-                "
-                done := false.
-                [done] whileFalse:[
-                    chunk := inStream nextChunk.
-                    chunk isNil ifTrue:[
-                        done := true
-                    ] ifFalse:[
-                        outStream nextChunkPut:chunk.
-                        outStream cr.
-                        done := chunk isEmpty
-                    ]
-                ].
-            ] ifFalse:[
-                outStream nextChunkPut:chunk.
-                outStream cr
-            ]
+            outStream close.
+            inStream close.
         ].
-        outStream close.
-        inStream close.
+
         changeFileName asFilename renameTo:(changeFileName , '.bak').
         tempfile renameTo:changeFileName.
         anyChanges := false
     ].
     ^ true
 
-    "Modified: 5.9.1996 / 17:20:26 / cg"
     "Modified: 2.12.1996 / 22:29:15 / stefan"
+    "Modified: 31.7.1997 / 18:27:14 / cg"
 ! !
 
 !ChangesBrowser methodsFor:'termination'!
@@ -1794,24 +1801,29 @@
 terminate
     "window manager wants us to go away"
 
-    |action|
+    |action again|
 
     anyChanges ifTrue:[
-        action := OptionBox 
-                          request:(resources at:'changefile has not been updated from the modified changelist.\\Update before closing ?') withCRs
-                          label:'ChangesBrowser'
-                          form:(WarningBox iconBitmap)
-                          buttonLabels:(resources array:#('cancel' 'don''t update' 'update'))
-                          values:#(#abort #ignore #save)
-                          default:#save.
-        action == #abort ifTrue:[^ self].
-        action  == #save ifTrue:[
-            self writeBackChanges
-        ].
+        again := true.
+        [again] whileTrue:[
+            action := OptionBox 
+                              request:(resources at:'changefile has not been updated from the modified changelist.\\Update before closing ?') withCRs
+                              label:'ChangesBrowser'
+                              form:(WarningBox iconBitmap)
+                              buttonLabels:(resources array:#('cancel' 'don''t update' 'update'))
+                              values:#(#abort #ignore #save)
+                              default:#save.
+
+            again := false.
+            action == #abort ifTrue:[^ self].
+            action  == #save ifTrue:[
+                again := self writeBackChanges not
+            ].
+        ]
     ].
     self destroy
 
-    "Modified: 20.2.1996 / 20:48:06 / cg"
+    "Modified: 31.7.1997 / 18:29:06 / cg"
 ! !
 
 !ChangesBrowser methodsFor:'user interaction'!
@@ -2537,5 +2549,5 @@
 !ChangesBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.113 1997-07-24 16:07:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.114 1997-07-31 16:55:15 cg Exp $'
 ! !