Re: Invisible files (was Re: Small problem)
Re: Invisible files (was Re: Small problem)
- Subject: Re: Invisible files (was Re: Small problem)
- From: Nathan Day <email@hidden>
- Date: Wed, 18 Jun 2003 02:24:04 +0930
An easier way to test the invisible flag is to use launch services,
ckeck out either of these functions
LSCopyItemInfoForURL( CFURLRef inURL, LSRequestedInfo inWhichInfo,
LSItemInfoRecord * outItemInfo)
LSCopyItemInfoForRef( const FSRef * inItemRef, LSRequestedInfo
inWhichInfo, LSItemInfoRecord * outItemInfo)
you can use the function
FSPathMakeRef( [theString UTF8String], aFSRef, NULL )
to get a FSRef or you can just create a NSURL from you NSSring and cast
it to a CFURLRef
On Sunday, June 15, 2003, at 07:23 AM, Jesus De Meyer wrote:
That's exactly what I did and it still shows up. Here's the code to
check for invisble files:
- (BOOL)fileVisible:(NSString *)filePath {
FSRef fsRef;
OSStatus status;
FSSpec fsSpec;
status = FSPathMakeRef([filePath fileSystemRepresentation],
&fsRef,
NULL);
status = FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL,
&fsSpec, NULL);
FInfo fInfo;
OSStatus err = FSpGetFInfo(&fsSpec, &fInfo);
if(err)
return NO;
BOOL invisibleFlag = fInfo.fdFlags & kIsInvisible;
BOOL invisibleName = [[filePath lastPathComponent]
hasPrefix:@"."];
BOOL fileVisible = !(invisibleFlag && invisibleName);
return fileVisible;
}
Nathan Day
http://homepage.mac.com/nathan_day/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.