• 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: Rosyna <email@hidden>
  • Date: Fri, 30 Aug 2002 05:17:46 -0700

You'd create the new data in the temporary items folder, like Inside Macintosh says, then you'd save the data to the new file and call FSpExchangeFiles. There is no need to second guess it's functionality except that it will not work on UFS volumes. (And is probably one of the reasons so many apps don't work on UFS)

Ack, at 8/30/02, Malte Tancred said:

What if the app crash before FSExchangeObjects is called? You'll be stuck with the original content in foo.txt and the updated content in foo~.txt.

If I want to edit a file "the unix way" I make a copy of it, say foo.txt-new, edit the copy, then mv foo.txt-new foo.txt. The save is atomic. If I want a backup I'd copy foo.txt to foo~.txt at an appropriate time. Perhaps somthing like this:

1) copy foo.txt to foo.txt-new
2) copy foo.txt-new to foo~.txt
3) edit foo.txt-new
4) rename foo.txt-new foo.txt

If the system crash at any time during these operations I'd know where to begin when the system is up and running again. The original data will never get lost.

This solution relies on the file names communicating what have been done. The former example - using FSExchangeObjects - could perhaps look at the dates of the files to see that foo~.txt is actually newer than foo.txt, and by that deduce that the app crashed before the save was completed.

--


Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug

Unsanity: Unsane Tools for Insanely Great People
---

Please include any previous correspondence in replies, it helps me remember what we were talking about. Thanks.
_______________________________________________
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: Malte Tancred <email@hidden>)

  • Prev by Date: Re: Make a window intercept key events
  • Next by Date: Re: NSTextView Weirdness
  • Previous by thread: Re: Tracking files the right way
  • Next by thread: Re: Tracking files the right way
  • Index(es):
    • Date
    • Thread