[Top][All Lists]

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

Re: NSBundle -initWithPath: warning

From: Sheldon Gill
Subject: Re: NSBundle -initWithPath: warning
Date: Sat, 02 Apr 2005 13:12:10 +0800
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Richard Frith-Macdonald wrote:
On 2005-04-02 04:37:19 +0100 Sheldon Gill <sheldon@westnet.net.au> wrote:

I've looked over this some more and on this point I still think there is a case. The Foundation docs say it needs a "full path", not "thou shalt specify an absolute path".

Yes, the term 'full path' is not completely clear/well-defined. However, it's hard to see exactly what it could mean if it's not a synonym for 'absolute path'. I guess it could just mean 'path', or perhaps it could mean 'path without tilde escapes'.

I think you'll find that a tilde path works fine. It'll only be relative paths that cause problem when you change current directory.

It also says that any symlinks must be resolvable.

I read it as saying 'use a full path otherwise this may not be able to find your bundle and will return nil'.

I believe we comply with the letter of the docs and maintain compatibility without the check.

Still, it'd be interesting to test behaviour on MacOS.

I did that ... on an up to date version of MacOS-X, the behavior is that it allows you to supply a relative path, but when I did so, then changed the current working directory so that the path was no longer valid, then tried to use the bundle, I got a crash with a segementation violation.

My guess is that the Apple code just doesn't work reliably with relative paths, so they made the documentation tell you not to use them, rather than fixing the source.

I'd agree with that.

So the question of 'correct' behaviour remains. I'd suggest the isAbsolute check and warning isn't needed. Maybe convert from relative to absolute.

Personally, I'd go for the docs saying "use an absolute path because otherwise you'll encounter problems". The code doesn't check and leaves it to the programmer. {Or it checks in debug builds only}

I often miss the real HFS layer. You'd be able to get the volID and dirID for the folder and then it wouldn't matter anymore. You could even move the folder around the same volume. *sigh*


reply via email to

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