• 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: Include an executable without hard coding the path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Include an executable without hard coding the path


  • Subject: Re: Include an executable without hard coding the path
  • From: Rick Schmidt <email@hidden>
  • Date: Sat, 18 Jul 2009 01:24:01 -0500

Thanks Marcos I got that to work for the executable.  Getting the path
to the sequence input file is another story.  As far as I can see
NSBundle can only be assigned to an NSString.  I have to get it as a
char* because I have to pass it into a c++ tool I didn't write.  So
the the NSString has to go to a const char * and then a strcpy from
const char * to char *.  It seems like it should be easier and its not
quite working yet.

Rick

On Fri, Jul 17, 2009 at 11:37 PM, Marco S Hyman<email@hidden> wrote:
> On Jul 17, 2009, at 8:38 PM, Rick Schmidt wrote:
>
>> need to include an executable in my project when it runs.  I right
>> clicked my project and added an existing file pointing to the
>> executable, but how to I reference it in my code without a hard coded
>> full file path to my local drive?
>
> Guess: put the executable in with your resources and grab it with
>
>        ...
>        [task setLaunchPath: [[NSBundle mainBundle]
> pathForResource:@"blastcl3"
>                  ofType:nil]];
>        ...
>
> That assumes you are only building for one architecture.   You'll
> need to do some extra stuff to support more.
>
> Also, I'm assuming that you have the rights to distribute the
> executables that you need.  If not, then make the location
> of the executables a preferences item.  I do that with one
> of my apps.   I use a convenience function to grab the needed
> data.
>
>        [task setLaunchPath: [MyPrefs pathToApp]];
>
> MyPrefs is my class to handles app preferences.  I initialize the
> default values with the most likely location, /usr/bin or /opt/local/bin,
> etc., so it works for most folks without having to open a preference panel.
>
>
> /\/\arc
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Include an executable without hard coding the path (From: Rick Schmidt <email@hidden>)
 >Re: Include an executable without hard coding the path (From: Marco S Hyman <email@hidden>)

  • Prev by Date: Re: Include an executable without hard coding the path
  • Next by Date: Re: Include an executable without hard coding the path
  • Previous by thread: Re: Include an executable without hard coding the path
  • Next by thread: Re: Include an executable without hard coding the path
  • Index(es):
    • Date
    • Thread