Re: Calling a UNIX tool from another program
Re: Calling a UNIX tool from another program
- Subject: Re: Calling a UNIX tool from another program
- From: Jens Miltner <email@hidden>
- Date: Tue, 03 Jun 2008 16:45:18 +0200
Am 03.06.2008 um 16:28 schrieb Michael McLaughlin:
I am considering (not without much trepidation) of adding a menu
item to
allow users of a program to create a "Full Report", with figures and
equations, etc., via hardwired LaTeX.
I came up almost empty on my own search so
is there a source example anywhere showing how to
a) test for the presence of a functional UNIX tool(set) (like pdftex
or
MacTeX), and
Depends on whether you can expect the tools to be installed in a
standard location. In that case, NSFileManager or a plain call to
stat() may be sufficient to detect the existence of the binary.
Alternatively, you could search in a number of 'standard' locations (/
usr/bin, /usr/local/bin, ~/bin).
As another option, you could embed the tools in your application
package and launch them from a known location inside your app package
(see also below).
b) calling that tool from within an application (here, Cocoa)?
NSTask is the Cocoa object that handles launching external tools.
It's fairly easy to use - check out the documentation. There's also
sample code available at developer.apple.code that makes use of NSTask.
Does this sound like a bad (or fragile) idea for any reason?
Generally, not at all. There's tons of applications that use the power
of external tools.
However, one word of caution: using external tools dispatches some
work to other peoples work, but your users won't necessarily know,
which means if the net result is not what people expect (e.g. because
the external tool does not work very well with fancy path names, or
other weird problems), it may end up looking like your application is
buggy...
There's a couple of measures you could take to ensure quality of
service:
- embed a version known to work well in your application and use that
version
- check the version of the tool and warn the user if it's too old or
not your preferred version
etc.
HTH
</jum>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden