Skip to content

Commit 703f7a7

Browse files
committed
Canonicalize default target if it ends with .json
1 parent ed858da commit 703f7a7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/cargo/core/compiler/build_config.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,17 @@ impl BuildConfig {
6565
failure::bail!("target was empty")
6666
}
6767
}
68-
let cfg_target = config.get_string("build.target")?.map(|s| s.val);
68+
let cfg_target = match config.get_string("build.target")? {
69+
Some(ref target) if target.val.ends_with(".json") => {
70+
let path = target.definition.root(config).join(&target.val);
71+
let path_string = path
72+
.into_os_string()
73+
.into_string()
74+
.map_err(|_| failure::format_err!("Target path is not valid unicode"));
75+
Some(path_string?)
76+
}
77+
other => other.map(|t| t.val),
78+
};
6979
let target = requested_target.or(cfg_target);
7080

7181
if jobs == Some(0) {

0 commit comments

Comments
 (0)