A snip of code I'm sure someone will tear apart for me (From GMDC)

The Shape of Everything
A website mostly about Mac stuff, written by August "Gus" Mueller
May 20, 2008
(This post is from my old, old, super old site. My views have changed over the years, hopefully my writing has improved, and there is now more than a handful of folks reading my site. Enjoy.)

I just put this in VP's main.m file. Someone else might find it useful:

#ifdef DEBUG

NSWorkspace *workspace = [NSWorkspace sharedWorkspace]; NSArray *launchedApplications = [workspace launchedApplications];

for (NSDictionary *junk in launchedApplications) {     if ([@"com.flyingmeat.VoodooPad_Pro" isEqualToString:[junk objectForKey:@"NSApplicationBundleIdentifier"]]) {         NSLog(@"It's already running you moron");                  ProcessSerialNumber psn;         psn.highLongOfPSN = [[junk objectForKey:@"NSApplicationProcessSerialNumberHigh"] intValue];         psn.lowLongOfPSN = [[junk objectForKey:@"NSApplicationProcessSerialNumberLow"] intValue];         SetFrontProcess( &psn );                  NSBeep();         sleep(.5f); // let the beep actually happen.                  return 0;     } }

#endif