logger.validate.file: logger.validate.file

Description Usage Arguments Value Author(s) Examples

View source: R/logger.R

Description

Validates the specified file or directory exists. Prints an error or a warning message to the log if it does not exist, it is not of the accepted type or is not accessible.

Usage

1
logger.validate.file(file, is.file = TRUE, terminate = TRUE)

Arguments

file

Name of file or directory to validate.

is.file

Flag indicating if the given name must denote an existing file. If this is FALSE, the given name must denote a directory. Set this to NA if both types are an acceptable scenario.

terminate

Flag indicating if the execution is to be terminated in case the validation fails. This parameter determines if an error message (terminate is TRUE) or a warning message (terminate is FALSE) is to be sent to the log when the specified file or directory does not exist, is not of the accepted type or is not accessible.

Value

Whether the validation succeeded or not, invisibly. Note that when terminate is TRUE and the validation fails, the R session is closed and thus no value is returned.

Author(s)

Yassen Assenov

Examples

1
2
3
4
if (!logger.isinitialized())
  logger.start(fname = NA)
# Validate the current working directory exists
logger.validate.file(getwd(), FALSE)

RnBeads documentation built on March 3, 2021, 2 a.m.