(iOS) Add preliminary file logging - only seems to log stderr

right now and not stdout
This commit is contained in:
twinaphex 2013-05-13 12:11:30 +02:00
parent 1458678dbc
commit e3a8ea9389
1 changed files with 12 additions and 0 deletions

View File

@ -40,6 +40,8 @@
#define GSEVENT_MOD_ALT (1 << 19)
#define GSEVENT_MOD_CTRL (1 << 20)
//#define HAVE_DEBUG_FILELOG
static ios_input_data_t g_input_data;
static bool enable_btstack;
@ -142,6 +144,16 @@ static void handle_icade_event(unsigned keycode)
int main(int argc, char *argv[])
{
#ifdef HAVE_DEBUG_FILELOG
#if TARGET_IPHONE_SIMULATOR == 0
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *logPath = [documentsDirectory stringByAppendingPathComponent:@"console_stdout.log"];
freopen([logPath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stdout);
NSString *logPath2 = [documentsDirectory stringByAppendingPathComponent:@"console_stderr.log"];
freopen([logPath2 cStringUsingEncoding:NSASCIIStringEncoding], "a+", stderr);
#endif
#endif
@autoreleasepool {
return UIApplicationMain(argc, argv, NSStringFromClass([RApplication class]), NSStringFromClass([RetroArch_iOS class]));
}