• 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: testing for invisible files in a file browser
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: testing for invisible files in a file browser


  • Subject: Re: testing for invisible files in a file browser
  • From: Michele Balistreri <email@hidden>
  • Date: Wed, 9 Aug 2006 09:20:50 +0200

I wrote this code long ago that apparently catches all the invisible files

- (BOOL)isInvisibleFileAtPath:(NSString *)path
{
BOOL isHidden = NO;

LSItemInfoRecord itemInfo;
LSCopyItemInfoForURL((CFURLRef)[NSURL URLWithString:path], kLSRequestAllFlags, &itemInfo);
isHidden |= (itemInfo.flags & kLSItemInfoIsInvisible);

FSRef possibleInvisibleFile;
FSCatalogInfo catalogInfo;
FSPathMakeRef((unsigned const char *)[path fileSystemRepresentation], &possibleInvisibleFile, nil);
FSGetCatalogInfo(&possibleInvisibleFile, kFSCatInfoFinderInfo, &catalogInfo, nil, nil, nil);
isHidden |= (((FileInfo*)catalogInfo.finderInfo)->finderFlags & kIsInvisible) ? 1 : 0;

isHidden |= [path isEqualToString:@"/Network"];
isHidden |= [path isEqualToString:@"/mach"];
isHidden |= [path isEqualToString:@"/mach.sym"];
isHidden |= [path isEqualToString:@"/dev"];

return isHidden;
}


Feel free to use it, i guess is not under public domain :)

Il giorno 09/ago/06, alle ore 08:54, René van Amerongen ha scritto:


Op 9-aug-2006, om 1:58 heeft Nick Zitzmann het volgende geschreven:


On Aug 8, 2006, at 5:17 PM, Tyler Riddle wrote:

For instance,
when pointed at /etc (which is invisible to the finder on my machine),
the returned value indicates the folder is visible. I'm at a loss as
to why the code does not work. Can anyone provide some insight?

In addition to what was already mentioned, there are three different ways that a file may be marked as invisible:
1. The Finder metadata has the hidden bit set
2. The file/folder is listed in the .hidden file, if present

So far as I can see is .hidden in Tiger obsolete, but the existing one's are respected.


3. The file/folder name begins with a period

/etc is covered by case #2. You'll have to check for all three cases on each file you wish to test.

with what is /etc covered in Tiger? Because I have none .hidden

Thanks


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40briksoftware.com


This email sent to email@hidden

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >testing for invisible files in a file browser (From: "Tyler Riddle" <email@hidden>)
 >Re: testing for invisible files in a file browser (From: Nick Zitzmann <email@hidden>)
 >Re: testing for invisible files in a file browser (From: RenĂ© van Amerongen <email@hidden>)

  • Prev by Date: Re: testing for invisible files in a file browser
  • Next by Date: displaying an NSImage in custom NSView
  • Previous by thread: Re: testing for invisible files in a file browser
  • Next by thread: Re: testing for invisible files in a file browser
  • Index(es):
    • Date
    • Thread