File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,22 @@ is_installed <- function(path_pkg = ".") {
166
166
pkg_name <- unname(read.dcf(path_desc )[, " Package" ])
167
167
list (
168
168
name = pkg_name ,
169
- installed = rlang :: is_installed(pkg_name )
169
+ installed = is_installed_impl(pkg_name )
170
+ )
171
+ }
172
+
173
+ # When a package is removed from the library with [remove.packages()] and then
174
+ # loaded e.g. with [devtools::load_all()],
175
+ # [rlang::is_installed()] and similar returns `TRUE`,
176
+ # `pkg_name %in% installed.packages()` `FALSE` (but CRAN does not want to see
177
+ # `installed.packages()` used since it may be slow).
178
+ is_installed_impl <- function (pkg_name ) {
179
+ rlang :: with_handlers(
180
+ {
181
+ find.package(pkg_name , lib.loc = .libPaths())
182
+ TRUE
183
+ },
184
+ error = ~ FALSE
170
185
)
171
186
}
172
187
You can’t perform that action at this time.
0 commit comments