Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
halpo opened this issue Apr 24, 2012 · 0 comments
Closed

Comments

@halpo
Copy link

halpo commented Apr 24, 2012

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)
}
@hadley hadley closed this as completed in 5588e89 Jun 14, 2012
@lock lock bot locked and limited conversation to collaborators Sep 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants