OLD | NEW |
1 #import <UIKit/UIKit.h> | 1 #import <UIKit/UIKit.h> |
2 #include "SkApplication.h" | 2 #include "SkApplication.h" |
3 | 3 |
4 int main(int argc, char *argv[]) { | 4 int main(int argc, char *argv[]) { |
5 signal(SIGPIPE, SIG_IGN); | 5 signal(SIGPIPE, SIG_IGN); |
6 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | 6 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; |
7 application_init(); | 7 application_init(); |
| 8 |
8 // Identify the documents directory | 9 // Identify the documents directory |
9 NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES); | 10 NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES); |
10 NSString *docsDir = [dirPaths objectAtIndex:0]; | 11 NSString *docsDir = [dirPaths objectAtIndex:0]; |
11 const char *d = [docsDir UTF8String]; | 12 NSString *resourceDir = [docsDir stringByAppendingString:@"/resources"]; |
12 IOS_launch_type launchType = set_cmd_line_args(argc, argv, d); | 13 const char *d = [resourceDir UTF8String]; |
13 int retVal = launchType == kApplication__iOSLaunchType | 14 |
14 ? UIApplicationMain(argc, argv, nil, nil) : (int) launchType; | 15 // change to the dcouments directory. To allow the 'writePath' flag to use r
elative paths. |
| 16 NSFileManager *filemgr = [NSFileManager defaultManager]; |
| 17 int retVal = 99; |
| 18 if ([filemgr changeCurrentDirectoryPath: docsDir] == YES) |
| 19 { |
| 20 IOS_launch_type launchType = set_cmd_line_args(argc, argv, d); |
| 21 retVal = launchType == kApplication__iOSLaunchType |
| 22 ? UIApplicationMain(argc, argv, nil, nil) : (int) launchType; |
| 23 } |
15 application_term(); | 24 application_term(); |
| 25 [filemgr release]; |
16 [pool release]; | 26 [pool release]; |
17 return retVal; | 27 return retVal; |
18 } | 28 } |
OLD | NEW |