On Mon, Aug 4, 2008 at 4:43 PM, Patrick Walker <[EMAIL PROTECTED]> wrote:
> It seems that whenever I use Xcode to spawn the program, it is able to find
> the file but when spawning the program from Finder, it can never, ever find
> the file.  I've been looking online and no one seems to have come across
> this before or maybe it's because it's so late that I'm not seeing the
> obvious.
>

This is because the current working directory is different when an
application is launched through Finder (vs. Xcode or the terminal).
You can check the current working directory with NSFileManager's
-currentDirectoryPath; Xcode sets this to the directory your
application bundle is in, Finder sets it to "/".

I'd recommend using NSBundle to figure out where your application, and
use the NSString path manipulation methods:
    [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:filename]

Phil
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to