Description Usage Arguments Value Examples
Macro for constructing boolean check for valid path
1 | cmd_install_is_valid(path_search, util = NULL)
|
path_search |
function output of |
util |
value to pass to |
a function returning TRUE or FALSE if a valid install is detected.
With arguments: path
(a path to install location), util
an optional character(1)
to
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | if (.Platform$OS.type == "unix") {
search <- cmd_path_search(option_name = "bin_path", default_path = "/bin/")
valid_install <- cmd_install_is_valid(search)
# Returns TRUE if "/bin/" exists
valid_install()
# Returns FALSE if "bad/path/" doesn't exist
valid_install("bad/path/")
# Also works with options
search_option_only <- cmd_path_search(option_name = "bin_path")
valid_install2 <- cmd_install_is_valid(search_option_only)
options(bin_path = "/bin/")
valid_install2()
# Setting util = TRUE will check that all utils are also installed
search_with_utils <- cmd_path_search(default_path = "/bin", utils = c("ls", "pwd"))
valid_install_all <- cmd_install_is_valid(search_with_utils, util = TRUE)
valid_install_all()
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.