FileDirectory>>fileExists: (was: Re: [BUG]Unable to load BFAV, various problems )

Ned Konz ned at bike-nomad.com
Sat Apr 17 14:44:12 UTC 2004


On Friday 16 April 2004 9:40 pm, Tim Rowledge wrote:
> OK, I'm going to propose a couple of extensions to the FilePlugin. I'm
> pretty sure it is possible to wrap them in such a way that older VMs
> will be ok and of course old images on a new vm will just work as
> before.

Let's hope so...

> I would suggest a default macro in sq.h that simply implements
> dir_Exists as interpreterProxy->primitiveFail. Unless of course, all the
> platformers buy into the idea really quickly and make it pointless.

Is there some way to extend the idea further to get something like stat() or 
lstat() instead? Then we could use that for both the exists calls as well as 
getting other file information. I know that Dave added stat or something like 
it to his OSProcess plugin.

> A further extension I'd like to suggest is a prim to canonicalize
> filenames.

Depends on what you want from it. I can think of a few things one might want:

* illegal character mapping
* resolving symlinks
* removing /./ and /../
* substituting volume names or aliases

> I certainly have a nice OS call to do that much faster and 
> much more comprehensively than the current image code (you try
> understanding the RISC OS filename rules!) and I think *nix can use
> 'realpath()' at least for directory names.

The docs for realpath() on my system aren't encouraging:

"Never use this function. It is broken by design since it is impossible to 
determine a suitable size for the output buffer."


-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE



More information about the Squeak-dev mailing list