Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions R/conf.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
NULL

# sources 1 config file and returns the envir
sourceConfFile = function(conffile) {
sourceConfFile = function(conffile, ...) {
assertFile(conffile)

conf = new.env()
x = try(sys.source(conffile, envir = conf))
x = try(sys.source(conffile, envir = conf, ...))
if (is.error(x))
stopf("There was an error in sourcing your configuration file '%s': %s!", conffile, as.character(x))
checkConf(conf)
Expand Down Expand Up @@ -205,12 +205,14 @@ print.Config = function(x, ...) {
#' @param conffile [\code{character(1)}]\cr
#' Location of the configuration file to load.
#' Default is \dQuote{.BatchJobs.conf} in the current working directory.
#' @param ...
#' Further arguments to \code{sys.source} (currently just \code{chdir})
#' @return Invisibly returns a list of configuration settings.
#' @family conf
#' @export
loadConfig = function(conffile = ".BatchJobs.R") {
loadConfig = function(conffile = ".BatchJobs.R", ...) {
# checks are done in sourceConfFile
conf = sourceConfFile(conffile)
conf = sourceConfFile(conffile, ...)
assignConf(conf)
invisible(setClasses(as.list(conf), "Config"))
}
Expand Down
4 changes: 3 additions & 1 deletion man/loadConfig.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
\alias{loadConfig}
\title{Load a specific configuration file.}
\usage{
loadConfig(conffile = ".BatchJobs.R")
loadConfig(conffile = ".BatchJobs.R", ...)
}
\arguments{
\item{conffile}{[\code{character(1)}]\cr
Location of the configuration file to load.
Default is \dQuote{.BatchJobs.conf} in the current working directory.}

\item{...}{Further arguments to \code{sys.source} (currently just \code{chdir})}
}
\value{
Invisibly returns a list of configuration settings.
Expand Down