R/path_expand.2.R

Defines functions path.expand.2 adaprHomeDir

Documented in adaprHomeDir path.expand.2

#' Location of options file and project listing. Swap / for \\ in path expand. 
#' @param x file path, could be relative or ~
#' @return Full filepath to x
#' @details See path.expand() in base R. Can be controlled in R profile by adding adaprHomeDir option. See adaprHomeDir().
#' @export
#' @examples 
#'  path.expand.2("~")
#'
path.expand.2 <- function(x){
  
  # Swap / for \\ in path expand
  
  temp <- path.expand(x)
  
  temp <- gsub("/~$","",temp)
  
  out <- gsub("\\\\","/",temp)
  
  if(length(adaprHomeDir())!=0){
    
    out <- adaprHomeDir()
    
  }
  
  return(out)
  
}
#' Identify adapr Home directory. Location of options file and project listing.
#' @return Full filepath to Adapr options and project listings directory.
#' @details This is automatically handled by defaultAdaprSetup(), but can be controlled in an "R profile" by adding adaprHomeDir R option ( e.g.,  options(adaprHomeDir="myPath")).
#' @export
#' @examples 
#'  adaprHomeDir()
#'
adaprHomeDir <- function(){
  
  return(options()$adaprHomeDir)
  
}
gelfondjal/adapr documentation built on Feb. 2, 2020, 1:32 a.m.