In IB (Interface Builder) set a delegate for “File's Owner”, such as MyAppController
Add this to the delegate of “File's Owner”
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { NSFileManager *fm = [NSFileManager defaultManager]; if([fm isReadableFileAtPath:filename]){ [self openLocation:filename]; return YES; } return NO; }
- (void)openLocation:(NSString *)newLocation {
if([fileManager fileExistsAtPath:newLocation]){ // do something }
}