Skip to content

Create parent output directory automatically if missing #280

@Phil1602

Description

@Phil1602

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. When running cargo about -o "./target/licenses.html" I need to ensure that the target directory is already present.

(This is not really an issue for us, but on the other hand probably a low-hanging-fruit 😄 )

Describe the solution you'd like
I would expect a idempotent call to create the directory if the (parent) directory is missing (think of mkdir -p). It seems that other tooling which contribute to Rust's target directory behaves the same (e.g. cargo build itself).

Describe alternatives you've considered
Workaround: Create the parent directory within CI/make tooling. Especially for the example target this is done implicitly through cargo build.

Additional context
Issue which occurs when executing cargo about without executing cargo build before.

[cargo-make] INFO - Execute Command: "cargo" "about" "-L" "error" "generate" "--workspace" "-o" "./target/licenses.html" "about.hbs"
2025-03-20 8:56:50.274202935 +00:00:00 [ERROR] output file ./target/licenses.html could not be written: No such file or directory (os error 2)
Error while executing command, exit code: 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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