• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How can i check if a file is hidden?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >How can i check if a file is hidden? (From: Jesus De Meyer <email@hidden>)

  • Prev by Date: Re: C question for you old guys ;-)
  • Next by Date: NSSound Leaks?
  • Previous by thread: Re: How can i check if a file is hidden?
  • Next by thread: Re: How can i check if a file is hidden?
  • Index(es):
    • Date
    • Thread