Skip to content

dev_packages() no longer work --> always return NULL #2689

@kforner

Description

@kforner

seems like dev_packages() does not work any longer (no surprise since it is not tested).

dev_packages <- function() {
  packages <- map_lgl(loadedNamespaces(), \(x) !is.null(pkgload::dev_meta(x)))

  names(packages)[packages]
}

The problem IMO is that map_lgl() sets the names from its input, loadedNamespaces().
But loadedNamespaces() returns a character vector with no names.
Hence that function always return NULL.

A quick fix could be:

dev_packages_fixed <- function() {
  loaded <- loadedNamespaces()
  have_meta <- sapply(loaded, \(x) !is.null(pkgload::dev_meta(x)))
  loaded[have_meta]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions