Re: How to apply arguments to .app application while starting it on Terminal?
Re: How to apply arguments to .app application while starting it on Terminal?
- Subject: Re: How to apply arguments to .app application while starting it on Terminal?
- From: Timothy Klein <email@hidden>
- Date: Sat, 4 Aug 2007 10:09:52 -0600
On 4 Aug 2007, at 2:47 AM, Kan Cheng wrote:
Hi all,
I'm quite new to mac, and I'm confusing how to apply arguments to .app
application while starting it on Terminal?
When we want to start a simple application on shell, we simply
start it
with command:
--------------------------
./someapplication arg1, arg2 ..
--------------------------
But as I know, those .app application is a bundle, and can be started
with open command:
--------------------------
Open someapplication.app
--------------------------
But on this way, I cannot apply those arguments to it. And I haven't
found any way to make it via searching Google.
So would you pls kindly teach me how to make it?
I've written Cocoa programs whose job is shell script user interface.
Thus, they absolutely must accept command line arguments, and I have
to call the program directly from inside the bundle.
I find the fact that "open" doesn't pass along command-line arguments
kind of annoying, but it seems to be the way it is. The easiest
solution for me was to provide a shell script that took arguments,
and passed them on to the Cocoa app, calling it inside the bundle
from the command line. This shielded the user from the bundle
contents. But the user, in the instance, is a shell script
programmer, so it's not like they need a lot of "shielding," but it's
still ugly to require anybody to be mucking around inside the .app
bundle.
NSProcessInfo and its -arguments: method is a very handy way to deal
with arguments in your Cocoa app.
Tim
--
Timothy Klein
KleinVox Software
_______________________________________________
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