I am working on a document-based application for Mac. This application has its own data model and methods for writing and reading such kind of document. If I want to start this application with a predefined document I can do it in the following way: open the command line and type in
open -a /Applications/MyApp.app file
This only works if the argument "file
" is a type of MyApp Document. Now I would like to execute MyApp with another kind of document (like a text file or something else). For example:
open -a /Applications/MyApp.app text.rtf
The delivered/committed
text file should be read and inserted automatically into a complete new document from MyApp. Now I try to catch the text.rtf inside the int main(int argc, char *argv[])
. But I get the following warning :
The document text.rtf could not be opened. MyApp cannot open files of this type
Does somebody has an idea how to catch the argument and import it as a part of a complete new MyApp-based document? How can I send it to the NSApplication?
Will be glad of any help.