TextView.st
changeset 2488 3e1ee2bbab6b
parent 2458 4a61ac0ba64c
child 2520 aed8069b4477
--- a/TextView.st	Tue Nov 27 18:32:05 2001 +0100
+++ b/TextView.st	Tue Nov 27 19:01:17 2001 +0100
@@ -1545,6 +1545,14 @@
 saveAs:fileName
     "save the contents into a file named fileName"
  
+    ^ self saveAs:fileName doAppend:false
+!
+
+saveAs:fileName doAppend:doAppend
+    "save the contents into a file named fileName;
+     if doAppend is true, the views contents is appended to the existing
+     contents - otherwise, it overwrites any previous file contents."
+ 
     self withCursor:Cursor write do:[
         |aStream msg|
 
@@ -1555,7 +1563,11 @@
         ].
 
         FileStream openErrorSignal catch:[
-            aStream := FileStream newFileNamed:fileName.
+            doAppend ifTrue:[
+                aStream := FileStream appendingOldFileNamed:fileName
+            ] ifFalse:[
+                aStream := FileStream newFileNamed:fileName.
+            ]
         ].
         aStream isNil ifTrue:[
             msg := resources string:'cannot write file ''%1'' !!' with:fileName.
@@ -3232,5 +3244,5 @@
 !TextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.175 2001-11-12 12:47:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.176 2001-11-27 18:01:17 cg Exp $'
 ! !