comparison src/main/macosx/SDLMain.m @ 1125:a6011e1394d9

Apparently MacOS X will sometimes pass command line arguments to a Cocoa app as an openFile() message, so we have to make sure we were launched from the Finder before accepting these as drag'n'drop documents, or they will just duplicate what's already in argc/argv.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 22 Aug 2005 14:18:15 +0000
parents 39408f59a0f7
children 304d8dd6a989
comparison
equal deleted inserted replaced
1124:4a061326d752 1125:a6011e1394d9
243 * 243 *
244 * This message is ignored once the app's mainline has been called. 244 * This message is ignored once the app's mainline has been called.
245 */ 245 */
246 - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename 246 - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
247 { 247 {
248 if (!gFinderLaunch) /* MacOS is passing command line args. */
249 return FALSE;
250
248 if (gCalledAppMainline) /* app has started, ignore this document. */ 251 if (gCalledAppMainline) /* app has started, ignore this document. */
249 return FALSE; 252 return FALSE;
250 253
251 unsigned buflen = [filename lengthOfBytesUsingEncoding:NSUTF8StringEncoding] + 1; 254 unsigned buflen = [filename lengthOfBytesUsingEncoding:NSUTF8StringEncoding] + 1;
252 char *arg = (char *) malloc(buflen); 255 char *arg = (char *) malloc(buflen);