• 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: Hidden file and 64bits Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hidden file and 64bits Cocoa


  • Subject: Re: Hidden file and 64bits Cocoa
  • From: Greg Parker <email@hidden>
  • Date: Mon, 23 Aug 2010 13:51:51 -0700

On Aug 23, 2010, at 6:57 AM, Olivier Tristan wrote:
> I'm looking for a way to get the hidden attribute of a file using cocoa as my applications is going to be ported to 64bits.
> I've took a look to NSFileManager and it do not seems to provide such facility.
>
> I used to do this
>
> |FSRef ref;
> OSStatus err = FSPathMakeRefWithOptions(path, kFSPathMakeRefDoNotFollowLeafSymlink, &ref, 0);
> if (err == noErr)
> {
>  LSItemInfoRecord info;
>  err = LSCopyItemInfoForRef(&ref, kLSRequestBasicFlagsOnly, &info);
>  if (err == noErr)
>  {
>    return ((info.flags & kLSItemInfoIsInvisible) != 0);
>  }
> }
> return false;|
>
> but this code required Carbon as far as I know.


FSPathMakeRefWithOptions() and LSCopyItemInfoForRef() are both available on 64-bit Mac OS. You can use that code as-is. (How can you tell? Find the function in the Mac OS SDK documentation. Functions that were dropped for 32-bit say "Availability: Not available to 64-bit applications".)

The Cocoa equivalent might be -[NSURL getResourceValue:forKey:error:], with the NSURLIsHidden key. I don't know if that's identical to kLSItemInfoIsInvisible, though.


--
Greg Parker     email@hidden     Runtime Wrangler


_______________________________________________

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: 
 >Hidden file and 64bits Cocoa (From: Olivier Tristan <email@hidden>)

  • Prev by Date: Saving Managed Object Context
  • Next by Date: Re: Hidden file and 64bits Cocoa
  • Previous by thread: Hidden file and 64bits Cocoa
  • Next by thread: Re: Hidden file and 64bits Cocoa
  • Index(es):
    • Date
    • Thread