Skip to content

Request: use current directory be used as the default package to build #87

@halpo

Description

@halpo

It's slightly annoying to set the package at the beginning of every session. Might I suggest that the current directory be used as the default. This requires very minor changes to the as.package function. I thought this so minor a change that there was no need to include it in a formal pull request.

#' Coerce input to a package.
#' 
#' Possibile specifications of package:
#' \itemize{
#'   \item path
#'   \item name (lookup in .Rpackages)
#'   \item package object
#' }
#' @param x object to coerce to a package
#' @export
as.package <- function(x = NULL) {
  if (is.null(x)) {
    x <- get_last_package()
  }
  if (is.null(x)) {
    message("package not set, checking '.'")
    x <- '.'
  } 
  else if (is.package(x)) 
    return(x)

  path <- find_package(x)
  if (is.null(path)) {
    stop("Can't find package ", x, call. = FALSE)
  }

  pkg <- load_pkg_description(path)
  set_last_package(pkg)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions