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
  }
})

Try the startup package in your browser

Any scripts or data that you put into this service are public.

startup documentation built on April 3, 2023, 5:48 p.m.