OLD | NEW |
| 1 /* |
| 2 * Copyright 2011 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
1 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
2 #include "SkApplication.h" | 8 #include "SkApplication.h" |
3 | 9 |
4 int main(int argc, char *argv[]) { | 10 int main(int argc, char *argv[]) { |
5 signal(SIGPIPE, SIG_IGN); | 11 signal(SIGPIPE, SIG_IGN); |
6 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | 12 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; |
7 application_init(); | 13 application_init(); |
| 14 |
8 // Identify the documents directory | 15 // Identify the documents directory |
9 NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES); | 16 NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES); |
10 NSString *docsDir = [dirPaths objectAtIndex:0]; | 17 NSString *docsDir = [dirPaths objectAtIndex:0]; |
11 const char *d = [docsDir UTF8String]; | 18 NSString *resourceDir = [docsDir stringByAppendingString:@"/resources"]; |
12 IOS_launch_type launchType = set_cmd_line_args(argc, argv, d); | 19 const char *d = [resourceDir UTF8String]; |
13 int retVal = launchType == kApplication__iOSLaunchType | 20 |
14 ? UIApplicationMain(argc, argv, nil, nil) : (int) launchType; | 21 // change to the dcouments directory. To allow the 'writePath' flag to use r
elative paths. |
| 22 NSFileManager *filemgr = [NSFileManager defaultManager]; |
| 23 int retVal = 99; |
| 24 if ([filemgr changeCurrentDirectoryPath: docsDir] == YES) |
| 25 { |
| 26 IOS_launch_type launchType = set_cmd_line_args(argc, argv, d); |
| 27 retVal = launchType == kApplication__iOSLaunchType |
| 28 ? UIApplicationMain(argc, argv, nil, nil) : (int) launchType; |
| 29 } |
15 application_term(); | 30 application_term(); |
| 31 [filemgr release]; |
16 [pool release]; | 32 [pool release]; |
17 return retVal; | 33 return retVal; |
18 } | 34 } |
OLD | NEW |