• 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: Tracking files the right way
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tracking files the right way


  • Subject: Re: Tracking files the right way
  • From: Chris Hanson <email@hidden>
  • Date: Thu, 29 Aug 2002 19:47:08 -0500

At 5:47 PM -0400 8/29/02, Bill Bumgarner wrote:
It is occasionally very handy that an app like IB, TextEdit, emacs, etc... saves the last version as a backup version (i.e. edit 'foo.txt', click 'save', TE moves the current file to foo~.txt and saves the new content to foo.txt).

This is a bug in either TextEdit or Cocoa. TextEdit should save the new content to foo~.txt, and then atomically swap the directory entries for foo.txt and foo~.txt using FSExchangeObjects. This will preserve the file ID of foo.txt, which is how the alias tracks it.

FSExchangeObjects won't work on all volume types, unfortunately, but it will work on HFS+ and AppleShare mounts. On the other hand, on those volume types where it doesn't work, file IDs also aren't supported, so aliases to files on those volumes will probably wind up using full paths and doing what you expect. (If they don't, it means Carbon is probably synthesizing file IDs or something behind your back.)

The correct process for a safe save on a volume that doesn't support FSExchangeObjects is to write the new content to foo~.txt, rename the old file to some temporary name, rename foo~.txt to foo.txt, and rename the temporary name to foo.txt.

Of course, NSDocument should handle all of this transparently...

-- Chris

--
Chris Hanson | Email: email@hidden
bDistributed.com, Inc. | Phone: +1-847-372-3955
Making Business Distributed | Fax: +1-847-589-3738
http://bdistributed.com/ | Personal Email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Tracking files the right way
      • From: Malte Tancred <email@hidden>
References: 
 >Re: Tracking files the right way (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: [Pre-ANN] objc-source.org email addresses
  • Next by Date: Re: Tracking files the right way
  • Previous by thread: Re: Tracking files the right way
  • Next by thread: Re: Tracking files the right way
  • Index(es):
    • Date
    • Thread