[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in NSUser.m - NSSearchPathForDirectoriesInDomains()
From: |
Roland Schwingel |
Subject: |
Re: Bug in NSUser.m - NSSearchPathForDirectoriesInDomains() |
Date: |
Mon, 21 Jul 2003 15:06:38 +0200 |
Hi...
> > As of the fact that today seems to be the "Send-in-a-bug" day, I also
> > want to contribute to this...
> >
> > Well...There is a bug in NSUsers NSSearchPathForDirectoriesInDomains()
> > function.
> > This function should return a NSArray containing all directories to
> > search. The function itself builds up a list of directories and then
> > checks this list whether all entries are present in the filesystem.So
> > it should check the presence of each individual directory.
> > Unfortuanately it doesn't check for folders it checks for files (using
> > NSFileManager's -fileExistsAtPath: and not
> > -fileExistsAtPath:isDirectory:) so it cannot succeed here. My attached
> > patch will fix this.
>
> But ... the -fileExistsAtPath: method is supposed to return YES if the
> path specifies a directory.
For me it returns here (on windows) NO if it is a directory and not a
file...
> So, if it's returning NO, there is a bug in the -fileExistsAtPath:
> implementation rather than a bug
> in respect of whether it is used or -fileExistsAtPath:isDirectory: is
> used.
It would also be a way to fix it...
> In fact, since -fileExistsAtPath: is implemented as a call to
> -fileExistsAtPath:isDirectory:, I can't
> see how your patch can possibly fix any problem there might be.
In my patch I call
[fm fileExistsAtPath: path isDirectory:&isDir]
for files the method returns NO and isDir is also NO. For directories the
method returns NO and isDir is set to YES. The loop in
NSSearchPathForDirectoriesInDomains() is an eliminationloop. All not
existing folders are removed from the prebuild list. With my patch the
existing ones will remain, so doing what the function should do.
But even with a changed version of -fileExistsAtPath:isDirectory: my patch
here wouldn't harm because it is a just finer test for existance...
Roland