R/current_script.R

Defines functions current_script

Documented in current_script

#' Gets the pathname of the currently running startup script
#'
#' @return A character string
#' 
#' @export
current_script <- function() {
  current_script_pathname()
}

current_script_pathname <- local({
  .pathname <- NA_character_
  function(pathname = NULL) {
    if (is.null(pathname)) {
      pathname <- .pathname
    } else {
      .pathname <<- pathname
    }
    pathname
  }
})
HenrikBengtsson/startup documentation built on Jan. 31, 2024, 9:17 a.m.