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?




I suggest that he use the one thing about an app that a user can modify, that is, its Finder comments. Luckily Spotlight in Mac OS X 10.4 gives us a very convenient API to get the value of whatever the user has set by choosing the app in the Finder, doing a Get Info, and typing a string into Comments.


thats an interesting solution, but i would be using Comments which aren't Comments, they're Args. i think the CFblahArg key hack is cleaner.


So let's just make this the extra args field for his purposes.
Change main to appMain (to move it aside) and write a new main like this:

uh oh, you just broke something: i have to have a special main for OSX.

This extracts the Finder comments, parses them into an arg list, and
calls your old main with the argc and argv it expects.  It's
#ifdefed so that when compiled on a non-Mac platform it's basically
a one-stack-frame pass-through.

i really appreciate this solution and the time you spent coding a case for it, but i honestly think that i'd be going down the wrong path to bork the Comments namespace, when i could isolate the args into the Info.plist key namespaces, and not end up altering the purpose of other aspects of the Finder interface..


Code tested and works, but cleanup and error-checking are left as an
exercise for the reader.  Note that this does not do all the quoting
and globbing that a shell would; you can go to town with that if you
want.  It considers every space a delimiter; you can do more
sophisticated scanning on the string if you choose
(CFStringCreateArrayBySeparatingStrings looked convenient).
Mac OS X 10.4 only.

heh heh. thanks for the idea; i've chosen the CFblahArgs key as a home for my argv, and i'm moving on ..


--

;

Jay Vaughan

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



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.