diff --git a/DESCRIPTION b/DESCRIPTION index af2d19b..e502d3b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: xfun Type: Package Title: Supporting Functions for Packages Maintained by 'Yihui Xie' -Version: 0.42.3 +Version: 0.42.4 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person("Wush", "Wu", role = "ctb"), diff --git a/R/packages.R b/R/packages.R index 5459ffc..14fc58f 100644 --- a/R/packages.R +++ b/R/packages.R @@ -116,8 +116,11 @@ pkg_require = function(pkgs, which = length(sys.calls()) - 1) { ) } +# update all packages in libraries that are writable by the current user pkg_update = function(...) { - update.packages(ask = FALSE, checkBuilt = TRUE, ...) + libs = .libPaths() + libs = libs[file.access(libs, 2) >= 0] + for (l in libs) update.packages(l, ask = FALSE, checkBuilt = TRUE, ...) } # allow users to specify a custom install.packages() function via the global