Robzz / cargo-docset

Cargo subcommand to generate a Dash/Zeal docset for your Rust packages.
Apache License 2.0
100 stars 4 forks source link

Support changing target dir location. #24

Closed dstar4138 closed 3 years ago

dstar4138 commented 4 years ago

Describe the bug When the build-cache is changed from default [1], running cargo docset fails with an I/O read error.

[1] - https://doc.rust-lang.org/cargo/guide/build-cache.html

To Reproduce Steps to reproduce the behavior:

I use a shared cache as described in [1] above, a simple test is to override with an environment variable:

bash% CARGO_TARGET_DIR="$HOME/.cargo/target" cargo docset
Running 'cargo clean --doc'...
Running 'cargo doc'...
 Documenting libc v0.2.76
 ...
 Documenting clap v2.33.3
 Documenting testproject v0.1.0 (/home/dstar4138/Code/projects/testproject)
    Finished dev [unoptimized + debuginfo] target(s) in 11.17s
I/O read error: No such file or directory (os error 2)

Expected behavior Expected the docset directory to be generated within $CARGO_TARGET_DIR/docset.

Screenshots Not-Applicable.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

Robzz commented 4 years ago

That looks like a relatively easy fix, I'll try and do that soon. The feature request is a bit more work but it sounds quite doable and pretty useful, I'll look into it but no ETA :smiley:

dstar4138 commented 4 years ago

No stress mate! Thank you so much for your work on this!

dstar4138 commented 4 years ago

Oh, and meant to reference: https://docs.rs/cargo_metadata/0.11.2/cargo_metadata/struct.Metadata.html

It should let you get the target directory without much effort, and give you the value of:

cargo metadata --format-version=1 | jq '.target_directory'

Robzz commented 3 years ago

I wish it didn't take me this long to get to it, but the bug should now be fixed in master :tada: The feature request needs a bit of thought, so I've opened #31 to track this one.