// // main.m // RiC // // Created by Matt Mower on 24/01/2006. // Copyright __MyCompanyName__ 2006. All rights reserved. // #import #import #import #import static void debug_event_hook( rb_event_t event, NODE* node, VALUE self, ID mid, VALUE klass ) { } int main(int argc, char *argv[]) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSBundle* mainBundle = [NSBundle mainBundle]; NSString* scriptPath = [mainBundle pathForResource:@"cocoabug" ofType:@"rb"]; NSString* scriptFolder = [scriptPath stringByDeletingLastPathComponent]; NSArray* pathComponents = [scriptPath pathComponents]; NSString* scriptFileName = [pathComponents lastObject]; NSString* scriptName = [scriptFileName stringByDeletingPathExtension]; printf( "Load script: %s\n", [scriptName fileSystemRepresentation] ); printf( "From Folder: %s\n", [scriptFolder fileSystemRepresentation] ); NSString* operation = @"$: << \""; operation = [operation stringByAppendingString:scriptFolder]; operation = [operation stringByAppendingString:@"\""]; ruby_init(); ruby_script( "CocoaBug" ); rb_eval_string( [operation fileSystemRepresentation] ); rb_eval_string( "puts \"Ruby = #{RUBY_VERSION}\"" ); rb_eval_string( "puts \"Path = #{$:}\"" ); rb_load_file( [scriptPath fileSystemRepresentation] ); ruby_finalize(); [pool release]; // return NSApplicationMain(argc, (const char **) argv); return 0; }