+#ifdef __DARWIN__
+ // Mac OS X passes a process serial number command line argument when
+ // the application is launched from the Finder. This argument must be
+ // removed from the command line arguments before being handled by the
+ // application (otherwise applications would need to handle it)
+
+ if (argc > 1) {
+ char buf[6] = "";
+ strncpy(buf, argv[1], 5);
+
+ if (strcmp(buf, "-psn_") == 0) {
+ // assume the argument is always the only one and remove it
+ --argc;
+ }
+ }
+#else