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

NSDocument backups


  • Subject: NSDocument backups
  • From: James Mastro <email@hidden>
  • Date: Wed, 3 Mar 2004 19:34:32 -0500

My app writes a document that contains a large amount of data. Only some of it is loaded at any time and it loads it as needed. This works great until I try to resave a document. Let's say I saved a document called doc.abc. During the next saving, NSDocument makes a backup copy called doc~.abc, and makes me write the new data into a new document called doc.abc Why?? My document expects to be able to read from itself, and it needs to do that to save. When it tries to save now, it finds that its data no longer exists, as it has been moved to a~.doc.

Why can't NSDocument let me write to a folder of some random name, and just rename my original to the backup name afterwards? What's the best way to deal with this? I'm using NSURL's in my document to reference various things, and that's not working to well when NSDocument pulls the rug out from under me.

I'm about to try this. In writeToFile:ofType:, create the new directory with some temporary unused name, and rename the backup NSDocument made back to the name it is supposed to be. Then do the save as usual, which should work OK. Then rename everything back to what NSDocument expects it to be.

-jim
_______________________________________________
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.


  • Prev by Date: Re: NSTextStorage: Deadlock
  • Next by Date: Advice needed about a possible bug in NSMethodSignature or NSInvocation
  • Previous by thread: progress during HTTP POST upload?
  • Next by thread: Advice needed about a possible bug in NSMethodSignature or NSInvocation
  • Index(es):
    • Date
    • Thread