Re: Invisible files (was Re: Small problem)
Re: Invisible files (was Re: Small problem)
- Subject: Re: Invisible files (was Re: Small problem)
- From: Jesus De Meyer <email@hidden>
- Date: Sat, 14 Jun 2003 23:53:50 +0200
>
The icon file is actually named "Icon\r" (i.e., there's a return at
>
the end of the name). It should be marked as invisible by the OS,
>
meaning the "invisible" file flag is set (You can query that using the
>
Carbon call GetFInfo(), if all else fails, but there should be a Cocoa
>
file attribute equivalent to this).
>
>
".DS_Store" isn't marked as invisible, but checking whether the first
>
character is a period is the criterion you should go by for files that
>
don't have the invisible flag set. If that doesn't work for you, it
>
might help to see some of your code.
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;
}
_______________________________________________
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.