I have a vignette which uses pdfcrop
.
This is not going to be available on every computer or OS: The R maintainers have told me that pdfcrop
is on their Debian systems, but apparently not others, for example. So I'd like to include in the vignette some logic to figure out if this program is available and use it if possible (I'm using knitr
to build the vignette and hence knit_hooks$set(crop = hook_pdfcrop)
to activate it).
I know I can use .Platform
to get the OS, and if I'm on unix then I can use which pdfcrop
via system()
to tell me where/if the program is installed, but I don't know how to make this process general for OSX, linux, Windows etc, and I'm not sure how to properly grab the return value of which
or the corresponding commands for other platforms.
Put another way, I'm trying to do something like this question but I'm not checking for R
packages, I'm checking for non-R programs. I'm turning to SO since I have neither the knowledge nor the platforms to check it on.