[FIX] FileDirectory-directory-existence-fix-ac
Andrew Catton
andrew at beta4.com
Wed Feb 4 22:55:15 UTC 2004
In looking at this I also noticed that the behavior of directory
existence checking can be done in (at least) 2 ways, and that they
aren't entirely consistent (both before and after this fix):
If I have a directory named 'foo' in the default dir:
(FileDirectory default directoryNamed: 'foo') exists
ifTrue: [FileDirectory default deleteDirectory: 'foo'].
(FileDirectory default directoryNamed: 'foo') exists. "I would expect
false; is true"
On the other hand, if I do:
(FileDirectory default directoryExists: 'foo')
ifTrue: [FileDirectory default deleteDirectory: 'foo'].
(FileDirectory default directoryNamed: 'foo') exists. "is false as expected"
Is the first #directoryNamed: call doing something that requires
cleanup? Or is this a bug?
In any case, unless these 2 ways are actually supposed to be checking
different things in some way I'm missing, it's a little fishy that we
have 2 ways to check for directory existence.. and even fishier that
they aren't consistent.
Cheers, Andrew
andrew at beta4.com wrote:
> from preamble:
>
> Change Set: FileDirectory-directory-existence-fixes-ac
> Date: 4 February 2004
> Author: Andrew Catton
>
> Fixed a problem in testing for directory existence:
>
> - comment in FileDirectory>>directoryExists: claims that this method
> works whether it is passed an absolute or a relative pathname, but the
> 'FileDirectory on: filePath' code, executed when testing for the
> existence of a nested directory, assumes an absolute path; changed this
> code to 'self directoryNamed: filePath', which will actually work for
> both absolute and relative paths
> - tested on a unix g2 VM
>
>
> ------------------------------------------------------------------------
>
>
More information about the Squeak-dev
mailing list
|