StandardFileStream>>truncate:
Chris Muller
chris at funkyobjects.org
Fri Jun 3 18:18:12 UTC 2005
Here's something to make you scratch your head. When would the #size of
aStandardFileStream ever change merely by closing and then opening the file?
myFileStream size "3300"
myFileStream close; open
myFileStream size "50"
Ok, don't scratch; I've already done that. The answer is when you #truncate:
to 50 the file, it is not reflected by #size until the file is closed and
reopened.
It's #position does recognize the truncation however, if it was beyond the
truncation point of the now-shorter file, it reflects position at the end of
the file. This is my first time exploring truncate: so I don't now whether
this is a bug. But I've opened it on Mantis just in case.
It does appear to actually shorten the file and release the space back to the
OS; is this platform-independent?
More information about the Squeak-dev
mailing list
|