fix: Respect .cargo/config.toml build.target-dir#20072
Conversation
8847b3c to
f7a8307
Compare
| } | ||
| utf8_stdout(&mut cargo_config) | ||
| .map(|stdout| { | ||
| Utf8Path::new(stdout.trim_start_matches("build.target-dir = ").trim_matches('"')) |
There was a problem hiding this comment.
Nit: this breaks if the path contains quotes, e.g. build.target-dir = 'a " b' or build.target-dir = """a " ' b""".
There was a problem hiding this comment.
Right. There is general cleanup potential here. For one, we invoke cargo config three times now for the different things, which is unnecessary, we can just invoke it plain and read out the info from that we want from that output. Secondly, it supports json output (and json-value though I have no idea what that means). We should just use the json output for more robust deserialization.
There was a problem hiding this comment.
json is {"build":{"target-dir":"a \" b"}}, json-value is "a \" b".
There was a problem hiding this comment.
Ah okay, it made no difference when I tested it but that was because I ran it without a target config so it returned the root object in both :D
Fixes #20070