FSCatalogInfo randomness
FSCatalogInfo randomness
- Subject: FSCatalogInfo randomness
- From: email@hidden
- Date: Tue, 30 Oct 2007 12:38:11 +0100
Hey everybody,
I'm using the code below (originally written by Michele Balistreri) to
determine whether a file is invisible or not (in Tiger). It works very well
- most of the time. But every once in a while I get really weird results
where almost all files are flagged as invisible. This happens randomly: the
exact same code gives different results from time to time. Usually correct,
sometimes not. Also, I have noticed that one particular file is arbitrarily
flagged as visible/invisible every time I check it. What's wrong here?
Thanks.
- (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"];
isHidden |= [path isEqualToString:@"/automount"];
return isHidden;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden