• 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: Storing NSDocument data in packages/bundles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Storing NSDocument data in packages/bundles


  • Subject: Re: Storing NSDocument data in packages/bundles
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 31 Dec 2008 11:29:40 -0800

On Dec 31, 2008, at 10:12, Markus Spoettl wrote:

It's rather surprising that NSDocument's save-as-copy-and-move strategy that works so well for single files backfires so heavily in my case.

Well, to be accurate, it's not a NSDocument issue, it's a problem with updating in place more than single file vs file package.


Incidentally, there's a fairly simple safe strategy for file packages:

-- Use a single "index" file that lists all the files that make up the current version of the document.

-- When saving, first write all the changed data to new files with new names.

-- Then update the index file atomically.

-- Then delete all the out of date files.

But that has a few drawbacks:

-- The individual file names are potentially different every time you save (which may or may not matter to you).

-- You need periodic housekeeping to detect orphaned files (due to saves that failed for some reason) and delete them.

-- Differences in file name encodings/naming rules might cause problems if the whole package is manually copied from one file system to another.

If you can come up with any acceptable safe strategy, then it's still an issue how to integrate it into NSDocument. writeSafelyToURL: seems like the obvious place, but its documentation says "must call super" if overridden, and calling super is probably going to mess up your strategy.

BTW, before you decide that long save times are unacceptable, take a look at how Amadeus behaves when saving large sound files. It has the best "slow" save (from a usability point of view) of any app I've seen.


_______________________________________________

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: Storing NSDocument data in packages/bundles
      • From: Markus Spoettl <email@hidden>
References: 
 >Storing NSDocument data in packages/bundles (From: Markus Spoettl <email@hidden>)
 >Re: Storing NSDocument data in packages/bundles (From: "Kyle Sluder" <email@hidden>)
 >Re: Storing NSDocument data in packages/bundles (From: Markus Spoettl <email@hidden>)
 >Re: Storing NSDocument data in packages/bundles (From: "Kyle Sluder" <email@hidden>)
 >Re: Storing NSDocument data in packages/bundles (From: Quincey Morris <email@hidden>)
 >Re: Storing NSDocument data in packages/bundles (From: Markus Spoettl <email@hidden>)

  • Prev by Date: mydoc.myext/QuickLook/Preview.html and full screen
  • Next by Date: NSPersistent Document but probably a Bindings Noobie Cry for Help
  • Previous by thread: Re: Storing NSDocument data in packages/bundles
  • Next by thread: Re: Storing NSDocument data in packages/bundles
  • Index(es):
    • Date
    • Thread