Commits

Anonymous committed 3eaa377

Add quit on error

Comments (0)

Files changed (2)

osx/MameController.h

     NSMutableArray * mPreviousGames;
     BOOL mGameLoading;
     BOOL mGameRunning;
+    BOOL mQuitOnError;
 }
 
 - (BOOL) isFiltered;

osx/MameController.mm

 
     NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
     
-    NSString * mGameName = [[defaults stringForKey: kMameGame] retain];
+    mGameName = [[defaults stringForKey: kMameGame] retain];
+    mQuitOnError = (mGameName == nil)? NO : YES;
+    NSLog(@"gameName: %@", mGameName);
     [self willChangeValueForKey: @"previousGames"];
     mPreviousGames = [[defaults arrayForKey: kMamePreviousGames] mutableCopy];
     if (mPreviousGames == nil)
             }
         }
         
+        if (mQuitOnError)
+        {
+            NSLog(@"Game not found: %@\n%@", mGameName, message);
+            [NSApp terminate: nil];
+        }
+        else
+        {
         NSAlert * alert = [[[NSAlert alloc] init] autorelease];
         [alert addButtonWithTitle: @"Try Again"];
         // [alert addButtonWithTitle: @"Quit"];
                           modalDelegate: self
                          didEndSelector: @selector(alertDidEnd:returnCode:contextInfo:)
                             contextInfo: nil];
+
+        }
     }
 }