On Tue 08/06/10 08:34, "Graham Cox" graham....@bigpond.com wrote:
> 
> On 08/06/2010, at 4:21 PM, John Joyce wrote:
> 
> > which
> > 
> > and that will let you locate the actual path of the
> command line tool you want to use. (pass that path to your next
> NSTask)
> 
> Ok... but doesn't that just displace the problem one step? How do I find
> the path to <which> without being able to run <which>
> reliably?

'which' is generally a shell built-in command, although it does also exist as a 
stand-alone binary in /usr/bin. What you're asking is actually more a Unix 
system programming question. In Unix you'd do a fork()/exec(), knowing that the 
$PATH environment variable will contain /usr/bin. In Cocoa, from what I gather, 
you use NSTask instead of fork()/exec(), and NSProcessInfo:environment to 
access/check $PATH. You probably don't need to bother with 'which', I assume 
that NSTask uses $PATH as well (correct me if I'm wrong).

-- 
Guillaume
http://telegraph-road.org


_______________________________________________

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