OLD | NEW |
1 #import <UIKit/UIKit.h> | 1 #import <UIKit/UIKit.h> |
2 #include "SkApplication.h" | 2 #include "SkApplication.h" |
3 | 3 |
4 extern void save_args(int argc, char *argv[]); | 4 extern bool set_cmd_line_args(int argc, char *argv[], const char* dir); |
5 | 5 |
6 int main(int argc, char *argv[]) { | 6 int main(int argc, char *argv[]) { |
7 signal(SIGPIPE, SIG_IGN); | 7 signal(SIGPIPE, SIG_IGN); |
8 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | 8 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; |
9 application_init(); | 9 application_init(); |
10 save_args(argc, argv); | 10 // Identify the documents directory |
11 int retVal = UIApplicationMain(argc, argv, nil, nil); | 11 NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES); |
| 12 NSString *docsDir = [dirPaths objectAtIndex:0]; |
| 13 const char *d = [docsDir UTF8String]; |
| 14 |
| 15 bool ranCommand = set_cmd_line_args(argc, argv, d); |
| 16 int retVal = ranCommand ? 0 : UIApplicationMain(argc, argv, nil, nil); |
12 application_term(); | 17 application_term(); |
13 [pool release]; | 18 [pool release]; |
14 return retVal; | 19 return retVal; |
15 } | 20 } |
OLD | NEW |