• 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: packaging external binaries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: packaging external binaries


  • Subject: Re: packaging external binaries
  • From: Darin Duphorne <email@hidden>
  • Date: Sun, 1 Jul 2001 19:03:43 -0500

I can't figure this out. I've read the foundation description of NSBundle and without some example code, the description isn't enough. For example, I can't even figure out if I need to name my folder containing the binary and data files with a .bundle name or some other name. I also can't figure out what the "type" ought to be. Also, (when used stand-alone) the binary normally requires that the data file either be in the same directory as the binary or in the /usr/lib directory. It runs fine outside the project bundle, but when added to the project, it says the NSBundle is nil. Here's my code (both the binary (named "bible") and its data files are in a directory called "bible.command".)
...
theTask=[[NSTask alloc] init];
[theArgs addObject:[brsEntryField stringValue]];
[theTask setLaunchPath:[[NSBundle mainBundle] pathForResource:@"bible" ofType:@".command"]];
[theTask setArguments:theArgs];
[theTask setStandardOutput:thePipe];
[brsDisplayField setString:@""];
[theTask launch];
...

On Friday, June 29, 2001, at 09:10 AM, Eric Peyton wrote:

Add your binary as a resource in to the project (as if it was an image, for example) and your data file as a reosurce in the project.

Then access the binary using the [[NSBundle mainBundle] pathForResource:@"<binary name>" ofType:@""]; and do the same with the data file. NSBundle makes it very easy.

It's easy as apple pie :-)

Eric

On Friday, June 29, 2001, at 12:14 AM, Darin Duphorne wrote:

Now that the NSTask is working, is it possible to bundle the binary and its data file within the application bundle so that they aren't separate files for install and so that they don't get moved out of the proper path?
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


  • Prev by Date: Re: Documentation Wish - was Re: AppKit source available as reference?
  • Next by Date: Re: [HELP] How to change Desktop background pic in OSX from Cocoa-Java?
  • Previous by thread: Working thread communicating with main thread (was: Threading Issues with Display)
  • Next by thread: NSEditText will not be enabled
  • Index(es):
    • Date
    • Thread