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:
Under Windows, the search for 'Google Chrome', 'Mozilla Firefox', 'Microsoft Word', 'Microsoft PowerPoint' and 'Microsoft Excel' is done in the registry, which means that only one version can be chosen, the one referenced in the registry. (you still can force another path with argument
dir
).'Microsoft Word', 'Microsoft PowerPoint' and 'Microsoft Excel' can not be located on linux OS.
the search for 'pip' is using the result of the search of 'python' to find the corresponding 'pip' executable.
Usage
exec_locate(exec, cache = TRUE, dir = NULL, version = NULL)
Arguments
exec |
executable identifier, a single character. Use one of these values:
|
cache |
if |
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., |
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")