Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to pass cmd line arguments to my carbon app?



On Sep 13, 2005, at 10:47 AM, Eric Schlegel wrote:

2) My.app is your wrapper, which is a directory.  You can't launch a

directory.  You have to launch ./My.app/Contents/MacOS/My -psn

01234567 -somearg -somearg2


so what if i want the user to be able to double-click the .app bundle normally in Finder, but with different args?


Mac OS X provides no user interface other than Terminal for users to specify command-line arguments. There's simply no way for a user to provide that info.


If you intend to provide some args built into your end-user app, why are they arguments? Anything cooked in to your Info.plist might as well be hardcoded into main().

If you intend to edit the Info.plist to communicate information to your app, why don't you just use the API that reads your bundle's plist to get that information, rather than trying to get it in argc/argv?
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/index.html

If you want your users to specify somewhat persistent configuration information, look at using CFPreferences and the defaults command.
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFPreferences/index.html

argc/argv is the API for command-line tools.  It is not part of the Mac OS X user model for users to provide parameters when double-clicking applications.

Chris
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: How to pass cmd line arguments to my carbon app? (From: Jay Vaughan <email@hidden>)
 >Re: How to pass cmd line arguments to my carbon app? (From: Chris Espinosa <email@hidden>)
 >Re: How to pass cmd line arguments to my carbon app? (From: Jay Vaughan <email@hidden>)
 >Re: How to pass cmd line arguments to my carbon app? (From: Eric Schlegel <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.