Hello
We usually implement file access the following way
aStream := CfsReadFileStream open: aFileName.
aStream isCfsError ifTrue: [
^ self.
].
However, recently, we encountered a "corrupted" file (Platform error 1392). This error gets detected in the "initialize" method of CfsReadFileStream. This signals an exception.
As we use the pattern above in many cases, it was very inconvenient to put an exception handler around the code.
To solve this issue, I modified the code in CfsReadFileStream to
privateOn: fileDescriptor
"private - Answer a new CfsWriteFileStream instance on the file specified by fileDescriptor.
Note: This method assumes that all checking(s) are made and no error occurs.
fileDescriptor
A open CfsFileDescriptor specifying the file over which to stream."
| err |
(err := fileDescriptor size) isCfsError ifTrue: [
^ err.
].
^self new
fileDescriptor: fileDescriptor;
initialize;
yourself
With this change, a corrupted file also returns a CfsError object.
It would be nice, if this change is included in the next VA/Smalltalk release - Thx
Regards
Thomas
--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
To post to this group, send email to
[hidden email].
Visit this group at
http://groups.google.com/group/va-smalltalk.
For more options, visit
https://groups.google.com/d/optout.