• 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: File system visiblilty
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File system visiblilty


  • Subject: Re: File system visiblilty
  • From: Rob Keniger <email@hidden>
  • Date: Thu, 15 Nov 2007 12:53:01 +1000


On 15/11/2007, at 10:52 AM, Justin Hawkwood wrote:

I use the following methods to get the visibility of files in the file system, but still some file some up in my list that do not show up in the Finder. Any suggestions to get results more like the Finder gives?


You're using LaunchServices which is the right way to do this, however you are not creating the FSRef properly. John is right, you shouldn't use NSASCIIStringEncoding as paths are definitely not ASCII. I use CFURLGetFSRef to create the FSRef which is much simpler.

You also don't need to check for the period at the beginning of the file name etc because the Launch Services check does all that for you.

I use code similar to this:

-(BOOL)isVisible:(NSString *)path
{
//check to see if the file is visible by inspecting the LaunchServices attributes
FSRef ref;
if (CFURLGetFSRef((CFURLRef)[NSURL fileURLWithPath:path],&ref))
{
CFTypeRef isInvisible;
if(LSCopyItemAttribute(&ref, kLSRolesAll, kLSItemIsInvisible, & isInvisible)==noErr)
{
if(isInvisible!=kCFBooleanTrue)
{
[visibleFolderContents addObject:currentFileName];
}
CFRelease(isInvisible);
}
}
}



-- Rob Keniger _______________________________________________

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


References: 
 >File system visiblilty (From: Justin Hawkwood <email@hidden>)

  • Prev by Date: How to get x-coordinate?
  • Next by Date: Re: File system visiblilty
  • Previous by thread: Re: File system visiblilty
  • Next by thread: Re: File system visiblilty
  • Index(es):
    • Date
    • Thread