• 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: How do I get a file reference w/o relying on the path?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I get a file reference w/o relying on the path?


  • Subject: Re: How do I get a file reference w/o relying on the path?
  • From: Jon Pugh <email@hidden>
  • Date: Tue, 6 Apr 2010 08:43:16 -0700

At 9:54 AM +0200 4/6/10, Jean-Daniel Dupas wrote:
>Le 4 avr. 2010 à 19:50, Jens Alfke a écrit :
>
>> You're saying that if I have a FSRef to a file, then the file is moved, the FSRef will still reference the moved file and not the location where it used to be?
>>
>> That's surprising to me, because FSRefs were created as a replacement for FSSpecs, which do not have that property (they were a struct {volume ID, dir ID, filename}.)
>>
>> Anyway, note that a file inode ID is more fragile than an alias/bookmark, because it won't survive the common practice of replacing an old copy of a file with a new one ("safe save") unless the code doing the replace is careful to propagate metadata to the new file.
>
>FSExchangeObjects and exchangedata(2) do not exchange the file ID.
>The new file will have the same ID than the old one, and so, the FSRef will point on the new file automatically.

Unfortunately, FSRefs don't survive the common practice of manually replacing the file in the Finder. This *does* change the file id and invalidates the FSRef. I had to change to explicitly saving an AliasRecord in an NSData to keep track of a file properly.

Jon
_______________________________________________

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: How do I get a file reference w/o relying on the path?
      • From: Jon Pugh <email@hidden>
References: 
 >How do I get a file reference w/o relying on the path? (From: Brad Stone <email@hidden>)
 >Re: How do I get a file reference w/o relying on the path? (From: Ken Thomases <email@hidden>)
 >Re: How do I get a file reference w/o relying on the path? (From: Jens Alfke <email@hidden>)
 >Re: How do I get a file reference w/o relying on the path? (From: Ken Thomases <email@hidden>)
 >Re: How do I get a file reference w/o relying on the path? (From: Jens Alfke <email@hidden>)
 >Re: How do I get a file reference w/o relying on the path? (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: Using Core Data ManagedObjectIDs to uniquely name files
  • Next by Date: Re: Wondering about that iPad page curling
  • Previous by thread: Re: How do I get a file reference w/o relying on the path?
  • Next by thread: Re: How do I get a file reference w/o relying on the path?
  • Index(es):
    • Date
    • Thread