gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSearchPathForDirectoriesInDomains and non-existing directories


From: Andriy Gapon
Subject: Re: NSSearchPathForDirectoriesInDomains and non-existing directories
Date: Tue, 25 Oct 2005 15:33:58 +0300
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051016)

on 25/10/2005 02:57 Sheldon Gill said the following:
> I think you've mis-diagnosed the behaviour problem. It isn't in
> NSSearchPath() but rather the calling code.

I agree that the code in NSColorList is not robust enough to handle
absent ~/GNUstep/Library directory. It should probably simply skip
saving color list of NSSearchPath() returns empty array.

> Creation of a path isn't and
> shouldn't be the responsibility of NSSearchPath(). That needs to be
> handled elsewhere. Generally it is, by the way.

Maybe there is some tool/routine that automatically creates all required
GNUstep directory hierarchy in user home directory ? It would be very
convenient for the first-time users of GNUstep.

> There is some sense in (1) but the question arises: "what do you do when
> the specified directory doesn't make sense on the current system?"

I agree that in the case you describe there should be no path returned.
But consider the other side of the coin - what if specific directory
does make sense but for some reason was not created (as it was in my
case) ? We don't even give a chance for calling code to know that path.
I think that the logic in NSSearchPath() for determining whether
directory makes sense or not based on its existense is flawed.


BTW, not that this really makes any difference, but may be of ineterest
to you:
http://wilshipley.com/blog/2005/10/pimp-my-code-part-5-special-apple.html
<quote>
Regarding:
"But, hey, does NSSearchPathForDirectoriesInDomains() actually check to
see if the directory it just pointed us to physically exists, or is it
just saying, 'Here's the name of the directory, hope that works out for
you'?"

In my informal tests, it appears that it just spits out the path that
the folder should be at. It doesn't bother to check if the folder exists
or not.
</quote>

Another link, contains very nice explanation for the function in
question (however it does not cover the question), much better than the
function's documentation:
http://www.wodeveloper.com/omniLists/macosx-dev/2002/September/msg00033.html

-- 
Andriy Gapon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]