.check_valid_util {cmdfun}R Documentation

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

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")

## End(Not run)
}

[Package cmdfun version 1.0.2 Index]