[FIX] FileDirectory-checkName-localName-fix-jf ( [er] Needs more
thinking )
Julian Fitzell
julian at beta4.com
Mon Feb 9 23:31:07 UTC 2004
Tim, my fix is to *not* use the full file name. I don't expect the
method to check the path, only the file name. The method is called
checkName:... not checkPath:...
All the senders pass a lone file name in, that's what the method name
suggests, and that (as you point out) is the only granularity at which
you can check validity. You can certainly write a method that tokenizes
the path and calls this method on each part, but the whole point of this
method is to give you back a valid filename even if the string you pass
in contains a directory separator (as, in my example, when filing out a
system category with a slash in it).
I agree that this issue needs (as does the rest of the file system code)
some thought to make it perfect. But I don't want to confuse that with
this fix needing more thinking - all it does it put the code inside the
method inline with its name and its senders, while making the code more
correct and useable.
Julian
tim at sumeru.stanford.edu wrote:
> I've been taking a quick look at this and I think we need to do it a bit
> more carefully. The initial problem I see is that using the full
> filename means that it will be truncated more aggressively than now.
> Consider #isLegalFileName: for example; instead of truncating the end
> leaf of the path it would now cut the whole string.
>
> I suspect that the proper thing to do is to tokenise the path and do
> checkName... on each part, then reasemble the string. Or, of course,
> call the OS api to do the job :-)
>
> tim
>
>
>
>
>
>
>
>
>
>
>
>
>
> <This post brought to you by BFAV2>
>
More information about the Squeak-dev
mailing list
|