Lint calls to .libPaths
Deployed content is usually executed in an environment that attempts to recreate the deploying user's configuration of packages/versions/R.
Modifying .libPaths() from within a Shiny application, R Markdown document, or Plumber API is likely to use paths that are not meaningful on the server.
Warn users about this likely problem.
Only need to warn if first argument (new) is not missing. Something like this:
trace(.libPaths, print = FALSE, quote({
if (!missing(new)) {
rlang::warn("Not a good idea on rsconnect")
}
}))
.libPaths()
.libPaths(getwd())
Open question: should it warn or error?
Error feels too strong, or if it is an error, it needs to be suppressible. Folks might have some /mnt/share/R library that they conditionally add to the library path. It's not a recommended pattern, but it happens.
We might want to reiterate the same warning when running the content (this would be a Connect change).