StandardFileStream>>#open:forWrite:

Tim Rowledge tim at sumeru.stanford.edu
Mon Jun 19 18:00:57 UTC 2000


Oddly enough there a two ways to check for a file existing, and they're
both pretty inefficient.
FileStream>isAFileNamed: tries to open the file and does a gc if the
prim fails, then closes the file if it opened.
FileDirectory>fileExists: lists all the files in the directory and
searches the list for the desired filename.

Oddly enough there are 17 senders of each message...

If you have the choice you might find the latter method quicker,
depending very much on circumstances, but really a 'proper' method is
needed.

Although the ANSI C lib doesn't include any suitable function, we have
already stepped away from only using that for all the directory prims.
I don't imagine any platform will completely lack a way to check for the
existence of a file, and it one did it would be just as easy to use the
open & close fakery in the platform prim code.

Oh, and it really isn't a message suited to FileStream anyway, it should
be for a FileName class.

tim

-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Useful random insult:- High relative humidity...  He's lost in a fog.





More information about the Squeak-dev mailing list