diff --git a/DESCRIPTION b/DESCRIPTION index 864ac4e..99d03e1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: Rpacman Type: Package Title: Very simple package manager for R -Version: 1.0.10 +Version: 1.0.11 Date: 2022-05-31 Authors@R: person("Craig", "Williams", email = "craig@avsdev.uk", role = c("aut", "cre")) URL: https://avsdev.uk/R/Rpacman diff --git a/R/activate.R b/R/activate.R index 16be6f4..650c485 100644 --- a/R/activate.R +++ b/R/activate.R @@ -6,11 +6,15 @@ #' any user library paths #' #' @export -activate <- function(totalIsolation = FALSE) { +activate <- function(totalIsolation = FALSE, lib_path = NULL) { check_pacman_dir() + pacman_lib_path <- file.path(getwd(), ".pacman/library") + if (!is.null(lib_path)) { + pacman_lib_path <- lib_path + } if (totalIsolation) { - environment(.libPaths)$.lib.loc <- c(file.path(getwd(), ".pacman/library"), .Library) + environment(.libPaths)$.lib.loc <- c(pacman_lib_path, .Library) } else { - .libPaths(c(file.path(getwd(), ".pacman/library"), .libPaths())) + .libPaths(c(pacman_lib_path, .libPaths())) } } \ No newline at end of file diff --git a/R/restore.R b/R/restore.R index f1d31d2..4768d06 100644 --- a/R/restore.R +++ b/R/restore.R @@ -60,11 +60,11 @@ #' #' @import parallel #' @export -restore <- function(totalIsolation = FALSE, installOpts = list(Ncpus = parallel::detectCores()), parallel = FALSE) { +restore <- function(totalIsolation = FALSE, lib_path = NULL, installOpts = list(Ncpus = parallel::detectCores()), parallel = FALSE) { old_opt <- options(stringsAsFactors = FALSE) on.exit(options(old_opt)) - activate(totalIsolation) + activate(totalIsolation, lib_path) get_cran_repo()