Re: Get current application path
Re: Get current application path
- Subject: Re: Get current application path
- From: Robert Cerny <email@hidden>
- Date: Tue, 23 Jan 2007 11:23:56 +0100
On 23.1.2007, at 10:49, Pavel S. Kovalev wrote:
Hello everyone,
I have to run perl script from my cocoa app:
----CODE----
NSMutableArray *arr = [[NSMutableArray alloc] init];
NSTask *firefoxCheckTask = [[[NSTask alloc] init] autorelease];
[firefoxCheckTask setLaunchPath:@"/usr/bin/perl"];
[arr
addObject:@"/Volumes/MyAppDMG/Installer.app/Contents/Resources/
firefoxCheck"];
[firefoxCheckTask setArguments:arr];
[firefoxCheckTask launch];
[firefoxCheckTask waitUntilExit];
int statusCode = [firefoxCheckTask terminationStatus];
----END_OF_CODE----
If I run my application(Installer.app) from XCode, all works fine
without
full path - I can run my perl script with relative path(something like
"Contents/Resources/firefoxCheck"). But if I run application
directly from
Finder, it's working directory became "/". Thus I have to use
hardcoded
absolute path.
I think, that it would be more flexible if I get Installer.app
path. How can
I obtain it?
--
With best regards,
Pavel S. Kovalev
mailto: email@hidden
ICQ: 2712239
Pavel,
will the method [[NSBundle mainBundle] pathForResource:(NSString*)
name] or [[NSBundle mainBundle] pathForAuxiliaryExecutable:(NSString*)
name] do the trick for you?
HTH
Robert
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden