Skip to content

Error: src/examples/README.md/Cargo.toml: Not a directory #29

Open
@parasyte

Description

@parasyte

When parsing workspace.members, the result of glob matching doesn't filter directories. It will gladly append Cargo.toml to file paths like README.md:

for member in &workspace.members {
for manifest_dir in glob::glob(workspace_root.join(member).to_str().unwrap())? {
let manifest_dir = manifest_dir?;
let manifest_path = manifest_dir.join("Cargo.toml");
let manifest = Manifest::parse_from_toml(&manifest_path)?;

Assumes a manifest being parsed contains:

[workspace]
members = [
    "examples/*",
    "tests/*",
]

... and these directories contain a README.md or other files as direct children. An example repo in the wild where this is done:

This kind of setup causes Subcommand::new() to return an error here:

utils::find_package_manifest_in_workspace(
workspace_manifest,
potential_manifest,
package,
)?

The glob result needs to be filtered to match directories. Checking manifest_dir.is_dir() is a good start, but symlinks also need to be followed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions