Skip to content

Commit

Permalink
Work around devtools vs. remotes
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Sep 26, 2023
1 parent 2391f46 commit e7e86bf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,20 @@ unique_obj <- function(name, pkgs) {
objs <- lapply(pkgs, getExportedValue, name)
names(objs) <- pkgs

# Finding the namespace where a function is really defined
env_names <- map_chr(objs, function(obj) {
tryCatch(
getNamespaceName(environment(obj)),
{
canonical_pkg <- getNamespaceName(environment(obj))
# Double-check that this is actually the correct object,
# e.g., devtools does interesting things here
canonical_obj <- getExportedValue(canonical_pkg, name)
if (identical(canonical_obj, obj)) {
canonical_pkg
} else {
""
}
},
error = function(e) ""
)
})
Expand Down

0 comments on commit e7e86bf

Please sign in to comment.