Ensure pacman library folder exists when activating/isolating (R does not auto-create it and resorts to the first existing library location)

This commit is contained in:
2023-09-28 11:44:55 +01:00
parent 9cea071018
commit cb0b58746f
3 changed files with 3 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
Package: Rpacman Package: Rpacman
Type: Package Type: Package
Title: Very simple package manager for R Title: Very simple package manager for R
Version: 1.0.5 Version: 1.0.6
Date: 2022-05-31 Date: 2022-05-31
Authors@R: person("Craig", "Williams", email = "craig@avsdev.uk", role = c("aut", "cre")) Authors@R: person("Craig", "Williams", email = "craig@avsdev.uk", role = c("aut", "cre"))
URL: https://avsdev.uk/R/Rpacman URL: https://avsdev.uk/R/Rpacman

View File

@@ -7,6 +7,7 @@
#' #'
#' @export #' @export
activate <- function(totalIsolation = FALSE) { activate <- function(totalIsolation = FALSE) {
check_pacman_dir()
if (totalIsolation) { if (totalIsolation) {
environment(.libPaths)$.lib.loc <- c(file.path(getwd(), ".pacman/library"), .Library) environment(.libPaths)$.lib.loc <- c(file.path(getwd(), ".pacman/library"), .Library)
} else { } else {

View File

@@ -3,5 +3,6 @@
#' #'
#' @export #' @export
isolate <- function() { isolate <- function() {
check_pacman_dir()
environment(.libPaths)$.lib.loc <- c(file.path(getwd(), ".pacman/library"), .Library) environment(.libPaths)$.lib.loc <- c(file.path(getwd(), ".pacman/library"), .Library)
} }