--- a/FileBrowser.st Wed Oct 22 15:16:33 1997 +0200
+++ b/FileBrowser.st Thu Oct 23 16:42:02 1997 +0200
@@ -10,6 +10,8 @@
hereby transferred.
"
+'From Smalltalk/X, Version:3.2.1 on 23-oct-1997 at 2:47:05 pm' !
+
StandardSystemView subclass:#FileBrowser
instanceVariableNames:'labelView filterField fileListView subView currentDirectory
fileList checkBlock checkDelta timeOfLastCheck showLongList
@@ -3430,47 +3432,49 @@
!
writeFile:fileName text:someText encoding:encoding
- |stream msg startNr nLines string|
-
- stream := (currentDirectory filenameFor:fileName) writeStream.
+ |stream errReason msg startNr nLines string|
+
+ errReason := ''.
+ FileStream streamErrorSignal handle:[:ex |
+ errReason := ex errorString.
+ ex return.
+ ] do:[
+ stream := (currentDirectory filenameFor:fileName) writeStream.
+ ].
stream isNil ifTrue:[
- msg := (resources string:'cannot write file ''%1'' !!' with:fileName).
- self showAlert:msg with:(FileStream lastErrorString)
+ msg := (resources string:'cannot write file ''%1'' !!' with:fileName).
+ self showAlert:msg with:errReason.
+ ^ self.
+ ].
+
+ someText isString ifTrue:[
+ stream nextPutAll:someText.
] ifFalse:[
- someText isString ifTrue:[
- stream nextPutAll:someText.
- ] ifFalse:[
- "
- on some systems, writing linewise is very slow (via NFS)
- therefore we convert to a string and write it in chunks
- to avoid creating huge strings, we do it in blocks of 1000 lines
- "
- startNr := 1.
- nLines := someText size.
- [startNr <= nLines] whileTrue:[
- string := someText asStringWithCRsFrom:startNr
- to:((startNr + 1000) min:nLines)
- compressTabs:compressTabs.
- encoding notNil ifTrue:[
- string := string encodeInto:encoding
- ].
- stream nextPutAll:string.
- startNr := startNr + 1000 + 1.
- ].
-"/ someText do:[:line |
-"/ line notNil ifTrue:[
-"/ stream nextPutAll:line.
-"/ ].
-"/ stream cr.
-"/ ]
- ].
- stream close.
- subView modified:false
- ]
+ "/
+ "/ on some systems, writing linewise is very slow (via NFS)
+ "/ therefore we convert to a string and write it in chunks.
+ "/ To avoid creating huge strings, we do it in blocks of 1000 lines.
+ "/
+ startNr := 1.
+ nLines := someText size.
+ [startNr <= nLines] whileTrue:[
+ string := someText asStringWithCRsFrom:startNr
+ to:((startNr + 1000) min:nLines)
+ compressTabs:compressTabs.
+ encoding notNil ifTrue:[
+ string := string encodeInto:encoding
+ ].
+ stream nextPutAll:string.
+ startNr := startNr + 1000 + 1.
+ ].
+ ].
+
+ stream close.
+ subView modified:false
"Created: 22.2.1996 / 15:03:10 / cg"
- "Modified: 22.2.1996 / 15:08:31 / cg"
"Modified: 18.9.1997 / 17:12:44 / stefan"
+ "Modified: 22.10.1997 / 12:34:38 / cg"
! !
!FileBrowser methodsFor:'private - presentation'!
@@ -3995,5 +3999,5 @@
!FileBrowser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.206 1997-10-21 18:38:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.207 1997-10-23 14:42:02 cg Exp $'
! !