NSBundle
NSBundle
- Subject: NSBundle
- From: Darin Duphorne <email@hidden>
- Date: Mon, 2 Jul 2001 10:43:44 -0500
I have attempted to post this several times and have seen several
digests since with it not listed. Is there a delay in postings, or is
it that the moderator is killing it?
================
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