Learn R Programming

cmdfun (version 1.0.2)

.check_valid_util: Checks for valid members of subdirectory

Description

Not meant to be called directly

Usage

.check_valid_util(util, utils = NULL, path = NULL)

Arguments

util

name of target located in path

utils

name of supported targets in path

path

path to directory

Value

safe path to util, or error if util does not exist

Examples

Run this code
# NOT RUN {
if (.Platform$OS.type == "unix") {
# this will return /full/path/to/bin
# or return an error for all values of util that are not "ls" and "pwd"
# or error if "ls" does not exist in "/bin"
.check_valid_util("ls", utils = c("ls", "pwd"), "/bin")

# }
# NOT RUN {
# This will throw error
.check_valid_util("badUtil", utils = c("ls", "pwd"), "/bin")
# }
# NOT RUN {
}
# }

Run the code above in your browser using DataLab