tools (version 3.5.0)

find_gs_cmd: Find a GhostScript Executable

Description

Find a GhostScript executable in a cross-platform way.

Usage

find_gs_cmd(gs_cmd = "")

Arguments

gs_cmd

The name, full or partial path of a GhostScript executable.

Value

A character string giving the full path to a GhostScript executable if one was found, otherwise an empty string.

Details

The details differ by platform.

On a Unix-alike, the GhostScript executable is usually called gs. The name (and possibly path) of the command is taken first from argument gs_cmd then from the environment variable R_GSCMD and default gs. This is then looked for on the system path and the value returned if a match is found.

On Windows, the name of the command is taken from argument gs_cmd then from the environment variables R_GSCMD and GSC. If neither of those produces a suitable command name, gswin64c and gswin32c are tried in turn. In all cases the command is looked for on the system PATH.

Note that on Windows (and some other OSes) there are separate GhostScript executables to display Postscript/PDF files and to manipulate them: this function looks for the latter.

Examples

Run this code
# NOT RUN {
## Suppose a Solaris system has GhostScript 9.00 on the path and
## 9.07 in /opt/csw/bin.  Then one might set
Sys.setenv(R_GSCMD = "/opt/csw/bin/gs")
# }

Run the code above in your browser using DataCamp Workspace