Re: Filtering out all invisible files in a file system browser
Re: Filtering out all invisible files in a file system browser
- Subject: Re: Filtering out all invisible files in a file system browser
- From: Jeremy Dronfield <email@hidden>
- Date: Tue, 9 Nov 2004 21:48:16 +0000
On 9 Nov 2004, at 5:10 pm, M. Uli Kusterer wrote:
At 16:56 Uhr +0000 09.11.2004, Jeremy Dronfield wrote:
I'd assumed there would be some way of filtering out all these
invisible files. Do I have to check individually by name for all the
ones which don't have "." prefixes and don't (seem to) have the
kIsInvisible flag?
No, there isn't. There are three criteria which files are invisible,
"." at the start of the name, kIsInvisible and name is in the
".hidden" file.
Thanks for that, Uli.
For the archive, this is the method which (so far as I can see) filters
out all invisibles:
- (BOOL)isVisible {
if ([[self lastPathComponent] hasPrefix:@"."])
return NO;
FSRef possibleInvisibleFile;
FSCatalogInfo catalogInfo;
OSStatus errStat = FSPathMakeRef([[self absolutePath]
fileSystemRepresentation], &possibleInvisibleFile, nil);
FSGetCatalogInfo(&possibleInvisibleFile, kFSCatInfoFinderInfo,
&catalogInfo, nil, nil, nil);
if (((FileInfo*)catalogInfo.finderInfo)->finderFlags & kIsInvisible)
return NO;
NSString *hiddenFile = [NSString stringWithContentsOfFile:@"/.hidden"];
NSArray *dotHiddens = [hiddenFile componentsSeparatedByString:@"\n"];
if ([dotHiddens containsObject:[self lastPathComponent]])
return NO;
return YES;
}
(This fits directly into the /Developer/Examples/AppKit/Simple Browser
example, in FSNodeInfo.)
Regards,
Jeremy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden