Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: Mocha
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 53 lines (37 sloc) 1.007 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
//
// JSTRunnerApplication.m
// jstalk
//
// Created by August Mueller on 2/17/09.
// Copyright 2009 Flying Meat Inc. All rights reserved.
//

#import "JSTRunnerApplication.h"
#import "JSTalk.h"

@implementation JSTRunnerApplication


- (void) runScript {
    
    NSString *scriptPath = [[NSBundle mainBundle] pathForResource:@"main" ofType:@"jstalk"];
    
    if (!scriptPath) {
        NSBeep();
        NSLog(@"Could not find main.jstalk");
        return;
    }
    
    NSString *src = [NSString stringWithContentsOfFile:scriptPath
                                              encoding:NSUTF8StringEncoding
                                                 error:nil];
    
    
    if (!src) {
        NSBeep();
        NSLog(@"Could not load main.jstalk");
        return;
    }
    
    JSTalk *jstalk = [[JSTalk alloc] init];
    
    [jstalk executeString:src];
}

- (id) init {
self = [super init];
if (self != nil) {
        [self runScript];
        exit(0);
}
return self;
}


@end

Something went wrong with that request. Please try again.