Re: About Document Packages
Re: About Document Packages
- Subject: Re: About Document Packages
- From: Jason Jobe <email@hidden>
- Date: Fri, 11 Feb 2005 17:05:48 -0500
You can build a file wrapper by hand and then pass the whole thing to be written out.
NSFileWrapper -> file:///Developer/ADC Reference Library/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSFileWrapper.html
Doing it by hand isn't too bad really.
Then you could use
NSDocument's
<x-tad-bigger>- (</x-tad-bigger><x-tad-bigger>NSFileWrapper</x-tad-bigger><x-tad-bigger> *)fileWrapperRepresentationOfType:(</x-tad-bigger><x-tad-bigger>NSString</x-tad-bigger><x-tad-bigger> *)</x-tad-bigger>aType
and
<x-tad-bigger>- (BOOL)loadFileWrapperRepresentation:(</x-tad-bigger><x-tad-bigger>NSFileWrapper</x-tad-bigger><x-tad-bigger> *)</x-tad-bigger>wrapper<x-tad-bigger> ofType:(</x-tad-bigger><x-tad-bigger>NSString</x-tad-bigger><x-tad-bigger> *)</x-tad-bigger>docType
to write and read respectively.
With regard to your sqlite you'll have to come up with something clever as I don't know any way to get at the data as a block.
Otherwise
NSDoc's
<x-tad-bigger>- (BOOL)writeToFile:(</x-tad-bigger><x-tad-bigger>NSString</x-tad-bigger><x-tad-bigger> *)</x-tad-bigger>fullDocumentPath<x-tad-bigger> ofType:(</x-tad-bigger><x-tad-bigger>NSString</x-tad-bigger><x-tad-bigger> *)</x-tad-bigger>docType<x-tad-bigger> originalFile:(</x-tad-bigger><x-tad-bigger>NSString</x-tad-bigger><x-tad-bigger> *)</x-tad-bigger>fullOriginalDocumentPath<x-tad-bigger> saveOperation:(</x-tad-bigger><x-tad-bigger>NSSaveOperationType</x-tad-bigger><x-tad-bigger>)</x-tad-bigger>saveOperationType
might give you enough to work with.
On Feb 11, 2005, at 4:30 PM, Seth Willits wrote:
Two things: Sorry the question wasn't posed correctly. I was asking more about suggestions on how to handle creating all the files, but yes, you're right about LSTypeIsPackage. The reason I didn't think it was working was because Xcode was lying to me. Despite the "Package" property of the document being checked, it didn't add <key>LSTypeIsPackage</key><true/> to the plist. If you uncheck it, then check it again, it adds it and everything works.
Right now I'm going the writeToFile and readFromFile route. If anyone with any experience found an easier or smarter way I'd like to hear about it, but this should work.
Seth Willits
---------------------------------------------------------------------------
President and Head Developer of Freak Software - http://www.freaksw.com
REALbasic Guru at ResExcellence - http://www.resexcellence.com/realbasic
"100% Recycled Electrons"
-- Law of Thermal Dynamics
---------------------------------------------------------------------------
On Feb 11, 2005, at 1:11 PM, Kevin Ballard wrote:
Isn't there a special key you add to the document type declaration in Info.plist?
On Feb 11, 2005, at 3:38 PM, Seth Willits wrote:
One of the document types in my application, I want to be stored as a package. If I'm using files that can be written in Cocoa like from NSData and all that it seems that it'll be fine using the NSFileWrapper methods (even if they do confuse me), but I also need to store an SQLite database in this package. It seems that I could overwrite writeToFile and readFromFile and write all the files myself, but if I do, I'm not sure how to handle creating the package itself. Other than creating a folder with an extension, I don't know how to say "this is a XXXXX document" since it seems like that doesn't happen automatically. Anyway, does anyone have any suggestions?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
- jason
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden