| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
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.
Regards Markus -- __________________________________________ Markus Spoettl
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden This email sent to 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>) | |
| >Re: Storing NSDocument data in packages/bundles (From: Quincey Morris <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.