diff --git a/DESCRIPTION b/DESCRIPTION index ef2fe46d7..b03d16539 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: renv Type: Package Title: Project Environments -Version: 0.17.0-35 +Version: 0.17.0-36 Authors@R: c( person("Kevin", "Ushey", role = c("aut", "cre"), email = "kevin@rstudio.com"), person("Posit Software, PBC", role = c("cph", "fnd")) diff --git a/NEWS.md b/NEWS.md index 8e99928be..c26cbd241 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,8 @@ # renv 0.18.0 (UNRELEASED) +* The `renv` sandbox is now placed within the `renv` cache directory. (#1158) + * Fixed an issue where `renv::status()` could erroneously report a project was out-of-sync when using explicit snapshots. (#1159) diff --git a/R/paths.R b/R/paths.R index a58c774c8..5092576ea 100644 --- a/R/paths.R +++ b/R/paths.R @@ -104,9 +104,9 @@ renv_paths_sandbox_unix <- function(project = NULL) { if (!is.na(root)) return(paste(root, prefix, sep = "/")) - # otherwise, build path in renv folder - project <- renv_project_resolve(project) - renv_paths_renv("sandbox", prefix, profile = TRUE, project = project) + # otherwise, build path in user data directory + userdir <- renv_bootstrap_user_dir() + paste(userdir, "sandbox", prefix, sep = "/") } diff --git a/R/sandbox.R b/R/sandbox.R index 5d02cf43d..c03689620 100644 --- a/R/sandbox.R +++ b/R/sandbox.R @@ -8,28 +8,6 @@ renv_sandbox_init <- function() { options(renv.sandbox.locking_enabled = enabled) } - # ensure sandbox is unlocked on exit - reg.finalizer( - renv_envir_self(), - renv_sandbox_finalize, - onexit = TRUE - ) - -} - -renv_sandbox_finalize <- function(self) { - - # check if we're enabled - if (!renv_sandbox_activated()) - return() - - sandbox <- .Library - if (!file.exists(sandbox)) - return() - - dlog("sandbox", "Unlocking sandbox in finalizer.") - renv_sandbox_unlock(sandbox) - } renv_sandbox_activate <- function(project = NULL) { @@ -229,12 +207,6 @@ renv_sandbox_task <- function(...) { renv_sandbox_generate(sandbox) } - # make sure the sandbox is locked - if (!renv_sandbox_locked(sandbox)) { - dlog("sandbox", "Locking sandbox in task callback.") - renv_sandbox_lock(sandbox) - } - } renv_sandbox_path <- function(project = NULL) {