On Mar 1, 2014, at 07:23 , Trygve Inda <[email protected]> wrote:
> The problem is that when there is a very small change (just adding or > removing one of the files in the package), the system does not save in > place. > > Rather it reads the previous package file completely, writes out a copy of > the package (400 MB) and then renames it. > > How can I get it to save in place? AFAIK, NSDocument never saves in place, and isn’t intended to (for safety reasons — what happens if your app crashes after some of the files have been updated but not others?). Instead, it achieves its package performance optimization by hard-linking unchanged files in the new (saved) package to files in the old (original) package. If your save is taking 40 seconds, that could mean: — The document is on a file system that doesn’t support hard linking. — The document is on a file system where hard linking 7500 files takes 40 seconds. — You didn’t preserve the original file sub-wrappers from the directory wrapper created when the document was opened, so NSDocument thinks all the files have changed. Note that it’s undocumented (again, AFAIK) what criteria NSDocument uses** to decide when a particular file wrapper represents “no change”, so it’s safest to keep the original NSFileWrapper objects from open time until save time. ** The most likely possibilities are ‘==’ on file wrappers, ‘isEqual:’ on file wrappers, or comparison of mod date and/or size of the actual files, but it could be something more obscure. _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
