• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Integrating Unix scripting in Cocoa app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Integrating Unix scripting in Cocoa app


  • Subject: Re: Integrating Unix scripting in Cocoa app
  • From: Nir Soffer <email@hidden>
  • Date: Thu, 9 Aug 2007 03:17:22 +0300


On Aug 8, 2007, at 20:02, Kevin Kuehl wrote:

--- Ron Fleckner <email@hidden> wrote:
File name extensions are meaningless in UNIX ...

... None of the
underlying UNIX infrastructure cares about or uses
filename extensions.

A filename extension is not required for Python scripts, but modules must use .py or .pyc extension to be importable.


If a user properly configures
the '#!' in a Python script, they shouldn't also be
forced to end it in a .py if they don't want to do so.

Using .py is not a good idea because the user may like to use specific Python version. The built-in Python is only 2.3, while the current version is 2.5. A Python developer may have multiple version of Python - 2.2, built in 2.3, 2.4, 2.5. The first python on the path may not be the version the user will like to use for scripting apps.


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

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

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

_______________________________________________

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


  • Follow-Ups:
    • Re: Integrating Unix scripting in Cocoa app
      • From: Ron Fleckner <email@hidden>
References: 
 >Re: Integrating Unix scripting in Cocoa app (From: Kevin Kuehl <email@hidden>)

  • Prev by Date: Re: Socket communications
  • Next by Date: Re: mouseMoved: or multiple trackingRects?
  • Previous by thread: Re: Integrating Unix scripting in Cocoa app
  • Next by thread: Re: Integrating Unix scripting in Cocoa app
  • Index(es):
    • Date
    • Thread