exec_locate {locatexec}R Documentation

Find an executable

Description

Searches for an executable in a some places and use the highest version found (unless a specific version is requested).

The function mimic the behavior of the rmarkdown::find_pandoc() function in order to locate programs.

Some methods work differently depending on the OS or the program:

Usage

exec_locate(exec, cache = TRUE, dir = NULL, version = NULL)

Arguments

exec

executable identifier, a single character. Use one of these values:

  • chrome: 'Google Chrome' executable

  • firefox: 'Mozilla Firefox' executable

  • libreoffice: 'LibreOffice' executable

  • node: 'node.js' executable

  • npm: 'npm' executable

  • python: 'python' executable

  • pip: 'pip' executable

  • excel: 'Microsoft Excel' executable

  • word: 'Microsoft Word' executable

  • powerpoint: 'Microsoft PowerPoint' executable

cache

if FALSE, search for the executable again even if the executable has been found previously.

dir

A character vector of directory paths under which the executable may be found.

version

The version of the executable to look for (e.g., "14.15.4"). If NULL (the default), it searches for the highest version.

Value

A list containing the path of the executable and its version if found. If not found, the version will be 0 and the exec_file will be NULL.

libreoffice

On some Ubuntu platforms, 'LibreOffice' require to add in the environment variable LD_LIBRARY_PATH the following path: ⁠/usr/lib/libreoffice/program⁠ (you should see the message "libreglo.so cannot open shared object file" if it is the case). This can be done with R command Sys.setenv(LD_LIBRARY_PATH = "/usr/lib/libreoffice/program/")

See Also

exec_available() will check if an executable is available and exec_version() will return the version of a located executable.

Examples

exec_locate("firefox")
exec_locate("chrome")
exec_locate("chrome", version = "88.0.4324.150")
exec_locate("libreoffice")
exec_locate("node")
exec_locate("npm")
exec_locate("python")
exec_locate("pip")
exec_locate("excel")
exec_locate("word")
exec_locate("powerpoint")

[Package locatexec version 0.1.1 Index]