• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Get current application path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get current application path


  • Subject: Re: Get current application path
  • From: "Pavel S. Kovalev" <email@hidden>
  • Date: Tue, 23 Jan 2007 14:28:24 +0300

This method works perfectly!

Thank you very much.

On 1/23/07, Vinay Prabhu <email@hidden> wrote:

You can use NSBundle to get the application path. NSBundle* bundle = [NSBundle mainBundle]; NSString* path = [bundle bundlePath];

-----Original Message-----
From: cocoa-dev-bounces+vinayprabhu=email@hidden
[mailto:cocoa-dev-bounces+vinayprabhu=email@hidden]On
Behalf Of Pavel S. Kovalev
Sent: Tuesday, January 23, 2007 3:19 PM
To: email@hidden
Subject: Get current application path


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
_______________________________________________

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:

. in
This email sent to email@hidden




--
With best regards,
Pavel S. Kovalev
mailto: email@hidden
ICQ: 2712239
_______________________________________________

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


References: 
 >Get current application path (From: "Pavel S. Kovalev" <email@hidden>)
 >RE: Get current application path (From: Vinay Prabhu <email@hidden>)

  • Prev by Date: RE: Get current application path
  • Next by Date: Re: How to draw NSString with centered alignment?
  • Previous by thread: RE: Get current application path
  • Next by thread: Best way to read a file from HTTP URL
  • Index(es):
    • Date
    • Thread