Skip to content

Commit

Permalink
move sandbox to cache directory
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinushey committed Mar 9, 2023
1 parent bb07754 commit 8b5cb2c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 32 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"))
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
6 changes: 3 additions & 3 deletions R/paths.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "/")

}

Expand Down
28 changes: 0 additions & 28 deletions R/sandbox.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8b5cb2c

Please sign in to comment.