Description
Problem
I have an application that needs to know where binaries installed via cargo install
are located in the system. I can roughly assume it will be in $HOME/.cargo/bin
, but according to this, when we do cargo install
the location will be determined by, in order of priority:
- --root option
- CARGO_INSTALL_ROOT environment variable
- install.root Cargo config value
- CARGO_HOME environment variable
- $HOME/.cargo
My idea was to use cargo
as a library crate (although I need to see the impact in terms of dependencies) to obtain this location. I assume cargo
already has some internal function that does that, as far as I checked it uses a resolve_root
function, but that function is not public.
In summary: it would be nice to have a function in cargo (as a library) that given a current working directory, could give me the installation root.
Proposed Solution
If I understand correctly, making resolve_root
public would suffice.
Notes
No response