Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions R/quarto.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,18 @@ quarto_run <- function(
# (e.g. to install dev package in a temporary library)
opt_in_libpath <- getOption("quarto.use_libpaths", TRUE)
if (isTRUE(opt_in_libpath) && !is.null(libpaths)) {
custom_env <- c(
custom_env,
R_LIBS = paste(libpaths, collapse = .Platform$path.sep)
)
libs_val <- paste(libpaths, collapse = .Platform$path.sep)
custom_env <- c(custom_env, R_LIBS = libs_val)

# On Windows, also point R_ENVIRON_USER at a temp Renviron that re-sets
# R_LIBS. The user Renviron is processed after the site Renviron, so this
# wins over any system-level reset of R_LIBS during R startup.
# https://github.com/quarto-dev/quarto-r/issues/217
if (.Platform$OS.type == "windows") {
environ_file <- tempfile("quarto_renviron_", fileext = "")
writeLines(sprintf("R_LIBS=%s", libs_val), environ_file)
custom_env <- c(custom_env, R_ENVIRON_USER = environ_file)
}
}

# This is required because `"current"` only is not supported by processx
Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/test-quarto.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ test_that("quarto_available()", {
test_that("quarto sees same libpaths as main process", {
skip_if_no_quarto()
skip_on_cran()
# Issue on windows with libpaths
# https://github.com/quarto-dev/quarto-r/issues/217
skip_on_os("windows")
qmd <- local_qmd_file(c("```{r}", "#| echo: false", ".libPaths()", "```"))
tmp_lib <- withr::local_tempdir("tmp_libpath")
withr::local_libpaths(tmp_lib, action = "prefix")
Expand Down
Loading