• 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
FSCatalogInfo randomness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FSCatalogInfo randomness


  • Subject: FSCatalogInfo randomness
  • From: email@hidden
  • Date: Tue, 30 Oct 2007 12:38:11 +0100

Hey everybody,
I'm using the code below (originally written by Michele Balistreri) to
determine whether a file is invisible or not (in Tiger). It works very well
- most of the time. But every once in a while I get really weird results
where almost all files are flagged as invisible. This happens randomly: the
exact same code gives different results from time to time. Usually correct,
sometimes not. Also, I have noticed that one particular file is arbitrarily
flagged as visible/invisible every time I check it. What's wrong here?

Thanks.


- (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"];

  isHidden |= [path isEqualToString:@"/automount"];

   return isHidden;

 }
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: FSCatalogInfo randomness
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: Beware of hidden NSTableView columns in Leopard (user defaults name clash)
  • Next by Date: Re: [Leopard] Debugging GC
  • Previous by thread: Re: Beware of hidden NSTableView columns in Leopard (user defaults name clash)
  • Next by thread: Re: FSCatalogInfo randomness
  • Index(es):
    • Date
    • Thread