Subversion Repositories bdplot

Rev

Blame | Last modification | View Log | RSS feed

.BdplotEnv <- new.env(parent=emptyenv())
.bdgetpars <- function() get(".BDPars", .BdplotEnv, inherits=FALSE)
.bdsetpars <- function(value) assign(".BDPars", value, envir=.BdplotEnv)

### Overruling with local config files if present.
### if reread=TRUE, local config files are reread. 
bd.reset <- function(reread=FALSE){
  if(reread){
    .bdsetpars(.bdconf.default())
    wd <- getwd()
    if(!is.na(file.info("~/.bdp_config.R")$size))
      {
        cat("Sourcing ~/.bdp_config.R\n")
        source(file="~/.bdp_config.R")
      }
    if(!is.na(file.info(paste(wd,"bdp_config_local.R",sep="/"))$size))
      {
        cat("Sourcing bdp_config_local.R\n")
        source(file="bdp_config_local.R")
      }
  } else {
    .bdsetpars(.BDPars.default)
  }

### this solution is kind of ugly. If the two lists contain elements of the same name, the first of them will be used.
.bdsetpars(c(.bdgetpars(),  .bdpapertemplates()))
  
}

bd.reset(reread=T)

.BDPars.default <- .bdgetpars()