On Jun 8, 2010, at 5:40 AM, Alastair Houghton wrote:

> On 8 Jun 2010, at 07:25, Graham Cox wrote:
> 
>> On 08/06/2010, at 4:16 PM, Stephen J. Butler wrote:
>> 
>>> b) In a working OS X system, the unix executables will always be where
>>> they're supposed to be (ie: /bin, /sbin, /usr/bin, /usr/sbin, etc).
>> 
>> Thanks Stephen, so given the four choices I looked at each and find zip in 
>> /usr/bin
>> 
>> The question is can I be sure it's there on every system, no matter how the 
>> user is logged in? i.e. can I hard-code the path?
> 
> Yes.  *Don't* as someone else suggested use the "which" (or /usr/bin/env, 
> which would be better) to locate it, because if you do that you might pick up 
> a version of zip that you haven't tested against (or some other program 
> entirely that happens to have installed an executable called "zip").  
> Hard-coding the path is the right thing to do.
> 
> Kind regards,
> 
> Alastair.
> 
> -- 
> http://alastairs-place.net
Just a suggestion of possibility with which.
Approaching things as though you were writing a shell script when when doing 
NSTask things is not wrong.

You could of course do other things as well to test version numbers and such if 
appropriate, depending on needs. 
Some users may indeed have updated or edited things at the command line level. 
As always, the best you can do is attempt to verify there is something there 
you can reliably work with and there is no guarantee there will be. ( unless 
the users will confidently be using standard installations )

To my knowledge there is nothing particularly Cocoa API about doing this beyond 
using NSTask._______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to