Re: NSTask Path
Re: NSTask Path
- Subject: Re: NSTask Path
- From: Douglas Davidson <email@hidden>
- Date: Tue, 14 Jan 2003 11:03:20 -0800
The point being that when you use a relative path like
Contents/Resources/main.pl, you are implicitly relying on the current
working directory. Unless you explicitly set the cwd, your task will
inherit it from your app, and your app from whatever launched it, so
the cwd could be anything, just as has always been the case for any
Unix process. The other problem here is that you should not have to
hard-code paths like Contents/Resources in your code. The solution for
both of these problems is to use NSBundle to locate your resource, in
this case your main.pl file. It will give you an absolute path to it
which you can then use as you choose.
Douglas Davidson
On Tuesday, January 14, 2003, at 10:17 AM, Buddy Kurz wrote:
see [NSBundle pathForResource:ofType:inDirectory:]
On Tuesday, January 14, 2003, at 09:29 AM, Rhon Fitzwater wrote:
Hi all (again),
[task setArguments:[NSArray arrayWithObject:[NSString
stringWithString:@"Contents/Resources/main.pl"]]];
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.