Re: How can i check if a file is hidden?
Re: How can i check if a file is hidden?
- Subject: Re: How can i check if a file is hidden?
- From: Eric Blair <email@hidden>
- Date: Tue, 10 Jun 2003 15:49:33 -0400
On 6/10/03 at 8:06 PM, Jesus De Meyer <email@hidden> wrote:
>
I check NSFileManager and I can't find anything on it. Even the
>
attributes don't have what I need. I suppose I could check if the file
>
starts with a dot, but not every file that's invisible starts with a
>
dot.
Here's some code I use that checks both the Finder flag and whether the name
starts with a dot.
- (bool)fileVisible:(NSString *)filePath {
FSSpec fsSpec = [filePath getFSSpec];
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 visible
}
There's a third way files can be made invisible, but I don't recall it off the
top of my head and, obviously, this code doesn't check it.
--Eric
_______________________________________________
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.