Skip to content

Commit

Permalink
Use the folder from which the R session is started as the renv projec…
Browse files Browse the repository at this point in the history
…t (not always the main folder).

Change renv test back from warning into error.
  • Loading branch information
dklein-pik committed Jun 20, 2024
1 parent b0f3cf6 commit 1346cb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ if (file.exists("renv.lock") && file.exists("README.md") && !file.exists("renv/o
# do not check if library and renv.lock are in sync, because normally renv.lock does not exist
options(renv.config.synchronized.check = FALSE)

# always set the renv project to the current direcotry (formerly done by renv/activate.R under version 0.16.0)
Sys.setenv("RENV_PROJECT" = getwd())

source("renv/activate.R")

# when increasing renvVersion first commit new version's activate script and
Expand Down
2 changes: 1 addition & 1 deletion scripts/start/run.R
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ run <- function() {
# make sure the renv used for the run is also used for generating output
if (!is.null(renv::project())) {
if (normalizePath(renv::project()) != normalizePath(outputdir)) {
warning("loaded renv=", normalizePath(renv::project()), " and outputdir=", normalizePath(outputdir), " must be equal.")
stop("loaded renv=", normalizePath(renv::project()), " and outputdir=", normalizePath(outputdir), " must be equal.")
}
argv <- c(get0("argv"), paste0("--renv=", renv::project()))
}
Expand Down

0 comments on commit 1346cb6

Please sign in to comment.