Skip to content

builtins.{path,filterSource} include all visited directories into output #4585

@vobloeb

Description

@vobloeb

builtins.path and builtins.filterSource use a filter function which return boolean value.
If it returns true on a directory, the directory will be visited AND included into output
If it returns false on a directory, the directory will be NOT visited AND NOT included.

So a single bool is responsible for two actions.

There is no way to visit directory but exclude it from output.
Either builtins.filterSource (path: type: lib.hasSuffix ".java" path) ~/project
which do not visit directories
Or builtins.filterSource (path: type: type == "directory" || lib.hasSuffix ".java" path) ~/project
which includes all directory tree into produced output

There is nothing which work like find ~/project -type f -name '*.java'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions