Storing NSDocument data in packages/bundles
Storing NSDocument data in packages/bundles
- Subject: Storing NSDocument data in packages/bundles
- From: Markus Spoettl <email@hidden>
- Date: Wed, 31 Dec 2008 00:51:17 -0800
Hello List,
I'm thinking of switching from a single-file based document file
storage to a package document with various files in it, I have a
little problem with that though:
My app stores a lot of data in a document, potentially hundreds of
megabytes. The problem with using single files and NSKeyedArchiver is
that one has to write everything, even if only a tiny part of the
structure changed. My data is clustered into handy little pieces which
could be saved into their own separate files within the package.
The problem is that - if I understand it correctly - when using file
wrapper -fileWrapperOfType: of NSDocument, I always have to provide
the complete wrapper, including all contained wrappers. That of course
is exactly what I hoped to avoid because it means I'd have to write
all data (this time into separate files/wrappers).
The NSBundle guide mentions another technique of using "traditional
file system methods" for loading and saving when you have special
needs. It's rather vague beyond that and I was hoping to get some
hints as to how to tackle this problem.
I wouldn't mind loading all the data at once. What I'm after is a
mechanism that would allow me to update only parts of the package
(adding, changing or deleting files as needed). Is there any chance I
can use -fileWrapperOfType: for that?
Looking at the NSDocument file saving message flow, it seems rather
difficult to come up with something completely different. The document
location you're saving to is not the final location of the real
document on the disk. That of course prevents you from only writing
parts of the document because the other stuff would be lost when your
new version is moved to its final destination.
So the question is, can I use NSDocument with an "update-relevant-
parts-of-a-package-only" saving mechanism? Thanks for any pointers!
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:
This email sent to email@hidden