• 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: Searchable persistent file reference
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Searchable persistent file reference


  • Subject: Re: Searchable persistent file reference
  • From: email@hidden
  • Date: Wed, 10 Dec 2008 15:26:28 +0100


On 10 Dec 2008, at 14:59, Ben wrote:

I am trying to store a reference to a file in a database, such that if the file moves, I can still search for it in my database.
I have read up on the Carbon Alias Manager and the third party BSAlias/NDAlias classes but none of these quite seem to fit the bill as it looks like I am working backwards from their designed use. ie, rather than finding the file from a database record, I want to lookup the database record from a known file.


In this situation, would it be best to use -[NSFileManager attributesOfItemAtPath:error:] and store the NSFileSystemFileNumber? I'm not sure how resilient this approach is. Or is there something that I have missed completely?

Not sure that's such a good idea for several reasons, 2 of which are:

The FileSystem number wouldn't survive a copy of the database and file to another volume.
I am not sure that NSFileSystemFileNumber will be available or persistent for some volume formats.


I think you should stick with the alias approach. If you need to match a moved file, then just resolve all the aliases in your database until you find the file you are looking for.

You could maybe speed up 'normal' searching by keeping a hash of the relative path from the database to the file and searching for that first, and only fall back to the full scan if that fails. (If a relative path is not available (i.e crossing volumes/servers) then just hash the full path of the file.)
_______________________________________________


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: 
 >Searchable persistent file reference (From: Ben <email@hidden>)

  • Prev by Date: Re: Problem drawing outside of drawRect: in a custom table cell
  • Next by Date: Re: Problem drawing outside of drawRect: in a custom table cell
  • Previous by thread: Re: Searchable persistent file reference
  • Next by thread: Re: Searchable persistent file reference
  • Index(es):
    • Date
    • Thread