NSWorkspace (BSInvisibility)
Language: Objective-C, Author: Michele Balistreri
License: Public domain
This category to NSWorkspace adds the method “isInvisibleFileAtPath:” which checks wether the file at a given path is invisible or not. On Mac OS X there are many ways of making a file invisible, this method will check all, and has some hardcoded paths, it reflects visibility in Finder.app.
NSWorkspace (BSInvisibility) source preview
#import "NSWorkspace+BSInvisibility.h" @implementation NSWorkspace (BSInvisibility) - (BOOL)isInvisibleFileAtPath:(NSString *)path { BOOL isHidden = NO; LSItemInfoRecord itemInfo; LSCopyItemInfoForURL((CFURLRef)[NSURL URLWithString:path], kLSRequestAllFlags, &itemInfo); isHidden |= (itemInfo.flags & kLSItemInfoIsInvisible); FSRef possibleInvisibleFile; FSCatalogInfo catalogInfo; FSPathMakeRef((unsigned const char *)[path fileSystemRepresentation], &possibleInvisibleFile, nil); FSGetCatalogInfo(&possibleInvisibleFile, kFSCatInfoFinderInfo, &catalogInfo, nil, nil, nil); isHidden |= (((FileInfo*)catalogInfo.finderInfo)->finderFlags & kIsInvisible) ? 1 : 0; isHidden |= [path isEqualToString:@"/Network"]; isHidden |= [path isEqualToString:@"/mach"]; isHidden |= [path isEqualToString:@"/mach.sym"]; isHidden |= [path isEqualToString:@"/dev"]; return isHidden; } @end
NSWorkspace (BSInvisibility) header preview
#import <Cocoa/Cocoa.h> #include <sys/param.h> #include <sys/mount.h> @interface NSWorkspace (BSInvisibility) - (BOOL)isInvisibleFileAtPath:(NSString *)path; @endDownload Archive
Compatible with:
- Mac OS X 10.0
- Mac OS X 10.1
- Mac OS X 10.2
- Mac OS X 10.3
- Mac OS X 10.4 PPC
- Mac OS X 10.4 Intel
- Mac OS X 10.5 PPC
- Mac OS X 10.5 Intel

Nice! But, shouldn't you #import <ApplicationServices/ApplicationServices.h> for LaunchServices? It's only incidental that NSWindow.h imports this.
It's probably OK to assume that ApplicationServices imports CoreServices since it's in the main header file.
Here i do not get any compilation warning, so i don't think it is necessary.
The last five lines of your code beginning with "isHidden" are wasteful.
Unfortunately they aren't (at least not on all versions of Mac OS X) because when I tested it those path didn't report to be invisible so I had to hardcode them.