|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
NSDocument based app takes each command line argument as a filename
For each argument I supply on the command line I get a message that the application can't open files of that type.
It is an NSDocument based application for OSX. I want to use the arguments later on via [[NSProcessInfo processInfo] arguments], but how do I avoid that each argument is taken as a file to open? |
|
|
|
0
|
|
|
#2 |
|
An NSDocument application is not designed to be used as a command line application. Mac OS X is a UNIX based OS. The main() function in a Mac OS app looks like this:
Code:
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}
|
|
|
|
0
|
|
|
#3 | |
|
Quote:
Using Senor Cuete's code as an illustration: Code:
int main(int argc, char *argv[])
{
// Your new code goes here.
// Make fake argc/argv here.
return NSApplicationMain( fake_argc, fake_argv);
}
|
||
|
|
0
|
|
|
#4 | |
|
Quote:
Calling NSApplicationMain() with fake argc/argv is indeed not that simple, the args passed are not documented (as fas as I know). So not easy to filter them out. Thanks for putting me on the right track! |
||
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 09:19 AM.







Linear Mode
