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

Re: File tracking problem


  • Subject: Re: File tracking problem
  • From: "Sean McBride" <email@hidden>
  • Date: Thu, 22 Jun 2006 11:03:56 -0400
  • Organization: Rogue Research

On 2006-06-22 12:43, Lachlan Cotter said:

>I am writing an app that needs to track files and keep references in
>an internal catalogue. I want the references to remain even if the
>file paths change.
>
>I gather from other threads on this list that aliases are the ideal
>tool for this.

Yes.  Alas, Cocoa has no classes to deal with aliases (do file a bug!).
So either use the C APIs or one of the 3rd party Cocoa wrapper classes.

>However, there is a caveat: I need to start with the
>file and find my catalogue record (not the other way around).

I don't see how it makes a difference.  If you store alias records in
your catalogue, you can just resolve each one to an FSRef then use
FSCompareFSRefs().  Of course, that's O(N).  How many items in your
catalogue?  I'm not sure how fast alias resolution is, but it probably
involves disk I/O.  I suggest browsing through Aliases.h and Files.h to
learn more.  An AliasHandle is opaque, so you can't just go comparing them.

>Is there a way to directly get a unique file ID or something
>equivalent that will enable me to keep a permanent reference to a
>file independent of it's path?

Yeah, an alias. :)

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


 _______________________________________________
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: 
 >File tracking problem (From: Lachlan Cotter <email@hidden>)

  • Prev by Date: Re: Imbedding unicode in strings
  • Next by Date: Re: How to add menu to menu bar
  • Previous by thread: File tracking problem
  • Next by thread: [Q] setAllowedFileTypes: of NSOpenPanel
  • Index(es):
    • Date
    • Thread