Slightly less clunky handling of stringsAsFactors

This commit is contained in:
2023-11-29 17:02:38 +00:00
parent 092bcdd866
commit 2ddb8a0819
7 changed files with 34 additions and 16 deletions

View File

@@ -11,10 +11,13 @@
#' @import parallel
#' @export
snapshot_create <- function(installOpts = list(Ncpus = parallel::detectCores())) {
old_opt <- options(stringsAsFactors = FALSE)
on.exit(options(old_opt))
lastSnapshot <- snapshot_latest()
customSources <- empty_sources()
if (!is.null(lastSnapshot) && "custom" %in% names(lastSnapshot$packages)) {
customSources <- rbind(customSources, lastSnapshot$packages$custom, stringsAsFactors = FALSE)
customSources <- rbind(customSources, lastSnapshot$packages$custom)
}
packages <- compile_imports(customSources, installOpts)
names(packages) <- c("core", "direct", "indirect", "custom", "install_order")