Dropping cached filesize in file prims

tim Rowledge tim at rowledge.org
Mon Jan 2 20:22:21 UTC 2006

There was a bit of discussion about removing the caching of the  
filesize from the file prims last week. I see Andreas has checked in  
a win32 file package that made the change and John & I were just  
discussing it as well. The bit that has always puzzled me is why it  
was there in the first place and I think I know the answer now. The  
original basic file access code was written to use only the ansi C  
lib calls and that doesn't inclide a file size function. You *can* do  
an fseek to EOF and an ftell when you get there, which is pretty much  
what is done. Once you step outside the ansilib room you can just  
find the actual file size and drop the caching.

We could of course change the Cross/plugins/FilePlugin file to be  
posix 'portable' and allow an fstat call to replace the caching. Or  
we could make a 'getFileSize()' that has to be platform supplied just  
like all the directory calls. Or we could leave the Cross file and  
note that just about any non-trivial-embedded/experimental platform  
will likely benefit from a more specific file access code and see the  
various examples in the svn tree. Unix and Mac would then need to  
implement such, presumably as posix calls.

tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: BA: Branch Approximate

More information about the Vm-dev mailing list