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 9/22/05 11:02 AM, Jay Vaughan didst favor us with:

> 
>> I think it makes perfect sense. The Mac has never targeted as its primary
>> market people who would pass command line arguments to applications.
>> Furthermore, all your ranting about standard C behavior aside, the preferred
>> language for Mac development in the early days was Pascal, not C.
> 
> ermm .. i'm not ranting, i'm complaining

I believe the correct term in this case is "whining."

> that main(int argc, char
> *argv[]) is useless on mac, whereas quite useful, still, elsewhere..
> and it just looks like a big "Apple says fark you" to anyone who
> still needs to depend on such mechanisms for their **portable**
> **non-Apple-exclusive** apps which are supposed to be supported on
> OSX, among many other target platforms ..
> 
> i care not one iota that Pascal was once the fetish of choice for
> Apple weenies.

Ah, that's a good plan, insult everyone here.

> indeed, all i want to know is if there is a 'secret' or (i can't find
> it in the docs) kind of Info.plist entry that can be used to
> construct the argv[] string.
> 
> like:
> 
> <key>CFBundleExecutableArgs</key>
> <string>-these -args -rock -ass</string>
> 
> this would be ideal.  its not possible, so i'll just have to use
> *more* Carbon to solve the problem, and write yet more redundant code
> to play along with Apple.  i'm used to that.

Then why are you whining so much now? LOL  Look, it probably comes down to
something simple like no one ever requesting this. I've never heard of
anyone who wanted to do this. That doesn't mean it couldn't be useful, but
since GUI applications on the Mac involve at least *some* of Mac-specific
code I doubt anyone at Apple ever thought anyone would want to do this. And
if no one wanted to do it, why should they invest time writing support for
it?

As for writing extra code for this, it wouldn't take more than a few lines
of code to read your CFBundleExecutableArgs value, which is far less than
you've written whining about all this:

char        args[ 256 ];
Boolean        success = false;
CFStringRef    cfArgs = ( CFStringRef )CFBundleGetValueForInfoDictionaryKey(
CFBundleGetMainBundle(), CFSTR("CFBundleExecutableArgs") );

if ( ( cfArgs != NULL ) && ( CFGetTypeID( cfArgs ) == CFStringGetTypeID() )
)
{
    success = CFStringGetCString( cfArgs, args, sizeof( args ),
kCFStringEncodingASCII );
    // Don't release args since it was obtained with a "Get" call.
}

All this complaining because you might have to write six lines of extra code
to do something in Mac OS X that maybe no one else has wanted to do? Yep,
I'd call that a clear cut case of whining.

>> Indeed, the Mac OS is not Windows, which is okay with most of us. ;-)  My
>> only response to comments about what you can do on other platforms but not
>> on the Mac is that the last time Microsoft had a "switchers" page it
>> featured an actress Microsoft had hired and a testimonial written by a
>> professional ad copywriter. ;-)
>> 
> 
> like, whatever, yo, it just works and goes bling when i need bling.

Some people have low expectations, for which Bill Gates is very grateful.
;-)
> 
>>> can i be sure that there are -no- ways to get argc/argv from a the
>>> bundle .plist?
>> I just have no idea about this one.
> 
> alright, thats what i need to know.  you have no idea.  cool.  i'll
> have to Apple'ize my arg parsing with a less-than-quick kow-tow to
> the Info.plist ..
> 
> and hey, its only sweat.

If you consider <10 lines of code "sweat," well...

Larry

 _______________________________________________
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>)



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.