hop-2012/gui_ocamlmsgAppDelegate.m

45 lines
1.0 KiB
Mathematica
Raw Normal View History

2012-05-01 15:13:56 +00:00
//
// gui_ocamlmsgAppDelegate.m
// gui-ocamlmsg
//
// Created by Tony Garnock-Jones on 2012-05-01.
// Copyright 2012 n/a. All rights reserved.
//
#import "gui_ocamlmsgAppDelegate.h"
@implementation gui_ocamlmsgAppDelegate
@synthesize window;
2012-05-01 17:16:53 +00:00
@synthesize webview;
2012-05-01 15:13:56 +00:00
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
2012-05-01 17:16:53 +00:00
task = [NSTask new];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(taskStatusChanged:)
name: NSTaskDidTerminateNotification
object: nil];
[task setCurrentDirectoryPath: @"/Users/tonyg/src/ocamlmsg"];
[task setLaunchPath: @"/Users/tonyg/src/ocamlmsg/ocamlmsg.native"];
[task setArguments: [NSArray new]];
[task launch];
sleep(1);
[[webview mainFrame] loadRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString: @"http://localhost:5678/"]]];
}
- (void) applicationWillTerminate: (NSNotification *) notification {
[task terminate];
}
- (void) taskStatusChanged: (NSNotification *) aNotification {
[NSApp terminate: self];
2012-05-01 15:13:56 +00:00
}
@end