The right place for an importer in the document architecture
The right place for an importer in the document architecture
- Subject: The right place for an importer in the document architecture
- From: Gideon King <email@hidden>
- Date: Thu, 8 Apr 2010 21:46:19 +1000
Hi
I have an importer to convert different file types into my native file format. Due to the nature of the importer process, I need to run it as a separate converter, so the process flow is:
1. The user selects the file to open (not in my native format)
2. The program reads it and writes out a file in my native format
3. I read the document from the native format version
4. Set the URL to nil because it is effectively a new document
5. Display the document
So I need to know where in the process I need to intercept the original file open request and do the conversion, and forward the request to open the converted file.
Would it be best to subclass NSDocumentController and override -makeDocumentWithContentsOfURL:ofType:error: and do the conversion, and call super with the new URL to the converted document, get the result back and set the URL to nil, and return it?
Would there be any side effects from that (because openDocument... used a different URL)?
...or will I need to go back to -openDocumentWithContentsOfURL:display:error: and work out the file type from the extension and work from there?
I'm assuming that anything within NSDocument or NSPersistentDocument is too late in the piece...
Thanks
Gideon
_______________________________________________
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