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: Integrating Unix scripting in Cocoa app




On 09/08/2007, at 10:17 AM, Nir Soffer wrote:

I would not use file extension to determine the way you run the script because it does not give the user enough control and is not the standard way to use scripts.

Either go with #! standard, or if you think it will be too hard, provide an easy way to select script type, and maybe even handle the script storage for the user, like Xcode or TextMate.

If you let the user manage scripts in the Finder like BBEdit, do NOT force them to make the scripts executable. In the command line, this make it easier for the user, but in your case, the user just have to select the script from a menu - you should run the script for the user. The user should not waste time chmod-ing files because you are lazy :-)

Hey! I'm not lazy. Just ignorant and stupid. Actually, that's what I wanted in the first place: to not have to require users to set the script as an executable. I think that's been the root of the longevity of this thread.



You can combine your easy to use way, #! line and file extension to make everyone happy:


1. If the script has app meta data saved in your app - use it

meta-data-app path/to/script

What do you mean by 'meta-data' in this case? (Remember, I'm not lazy, just...)



2. If the script has #!/path/to/app args... , use app with args to run the script:


	/path/to/app args... path/to/script

3. if the script has file extension, use the best guess for that extension:

	/usr/bin/env app path/to/script

4. let bash handle it :-)

	/bin/bash path/to/script


Best Regards,

Nir Soffer

OK, all worth investigating. Thanks for your input.

Ron
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Integrating Unix scripting in Cocoa app (From: Kevin Kuehl <email@hidden>)
 >Re: Integrating Unix scripting in Cocoa app (From: Nir Soffer <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.