Re: OK, break it down for me... (question about gzip)
Re: OK, break it down for me... (question about gzip)
- Subject: Re: OK, break it down for me... (question about gzip)
- From: <email@hidden>
- Date: Tue, 8 Jun 2010 11:00:58 +0200
On Tue 08/06/10 08:34, "Graham Cox" email@hidden 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 (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