Re: Calling Cocoa APIs from a command line application
Re: Calling Cocoa APIs from a command line application
- Subject: Re: Calling Cocoa APIs from a command line application
- From: Dave Keck <email@hidden>
- Date: Sat, 13 Sep 2003 13:33:55 -0400
I want to call an NSWorkspace method from a simple command-line
script. I
naively thought this would work:
Hi,
The simplest way to do this (I think) is to create a Foundation tool in
Project Builder. Then drag the AppKit framework from the
/System/Library/Frameworks directory into the "External Frameworks and
Libraries" folder in PB. This allows you to use the AppKit framework
within your project... therefore, the following code works fine:
#import <Foundation/Foundation.h>
#import <AppKit/NSWorkspace.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSLog(@"Hello, World!");
[[NSWorkspace sharedWorkspace] noteFileSystemChanged: @"/foo/bar"];
[pool release];
return 0;
}
- - -
Dave Keck
If I were smart I'd own a company to tell you the the name of.
"Contrariwise," continued Tweedledee, "if it was so, it might be; and
if it were so, it would be; but as it isn't, it ain't. That's logic."
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.