Skip navigation.
 
mlRe: NSTask Path
FROM : Douglas Davidson
DATE : Tue Jan 14 20:03:20 2003

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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlNSTask Path Rhon Fitzwater Jan 14, 18:29
mlRe: NSTask Path Vince DeMarco Jan 14, 19:14
mlRe: NSTask Path Buddy Kurz Jan 14, 19:17
mlRe: NSTask Path Todd de Gruyl Jan 14, 19:35
mlRe: NSTask Path Douglas Davidson Jan 14, 20:03
mlRe: NSTask Path Nathan Day Jan 15, 08:17