2015-04-09 14:57:54 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2011-06-24 15:57:30 +00:00
|
|
|
#import <UIKit/UIKit.h>
|
2011-08-30 19:14:13 +00:00
|
|
|
#include "SkApplication.h"
|
2012-10-02 18:33:14 +00:00
|
|
|
|
2011-06-24 15:57:30 +00:00
|
|
|
int main(int argc, char *argv[]) {
|
2011-07-07 19:26:42 +00:00
|
|
|
signal(SIGPIPE, SIG_IGN);
|
2011-06-24 15:57:30 +00:00
|
|
|
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
2011-08-30 19:14:13 +00:00
|
|
|
application_init();
|
2015-04-09 14:57:54 +00:00
|
|
|
|
2014-07-11 19:14:51 +00:00
|
|
|
// Identify the documents directory
|
|
|
|
NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
|
|
NSString *docsDir = [dirPaths objectAtIndex:0];
|
2015-04-09 14:57:54 +00:00
|
|
|
NSString *resourceDir = [docsDir stringByAppendingString:@"/resources"];
|
|
|
|
const char *d = [resourceDir UTF8String];
|
|
|
|
|
|
|
|
// change to the dcouments directory. To allow the 'writePath' flag to use relative paths.
|
|
|
|
NSFileManager *filemgr = [NSFileManager defaultManager];
|
|
|
|
int retVal = 99;
|
|
|
|
if ([filemgr changeCurrentDirectoryPath: docsDir] == YES)
|
|
|
|
{
|
|
|
|
IOS_launch_type launchType = set_cmd_line_args(argc, argv, d);
|
|
|
|
retVal = launchType == kApplication__iOSLaunchType
|
|
|
|
? UIApplicationMain(argc, argv, nil, nil) : (int) launchType;
|
|
|
|
}
|
2011-08-30 19:14:13 +00:00
|
|
|
application_term();
|
2015-04-09 14:57:54 +00:00
|
|
|
[filemgr release];
|
2011-06-24 15:57:30 +00:00
|
|
|
[pool release];
|
|
|
|
return retVal;
|
|
|
|
}
|