Skip to content

Commit a1f241a

Browse files
committed
Tweak Layout to allow for non json file targets with internal "."
1 parent 0c6bb24 commit a1f241a

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Diff for: src/cargo/core/compiler/layout.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,20 @@ impl Layout {
8686
/// adding the target triple and the profile (debug, release, ...).
8787
pub fn new(ws: &Workspace, triple: Option<&str>, dest: &str) -> CargoResult<Layout> {
8888
let mut path = ws.target_dir();
89-
// Flexible target specifications often point at filenames, so interpret
89+
// Flexible target specifications often point at json files, so interpret
9090
// the target triple as a Path and then just use the file stem as the
91-
// component for the directory name.
91+
// component for the directory name in that case.
9292
if let Some(triple) = triple {
93-
path.push(Path::new(triple)
94-
.file_stem()
95-
.ok_or_else(|| format_err!("invalid target"))?);
93+
let triple = Path::new(triple);
94+
if triple.extension().and_then(|s| s.to_str()) == Some("json") {
95+
path.push(
96+
triple
97+
.file_stem()
98+
.ok_or_else(|| format_err!("invalid target"))?,
99+
);
100+
} else {
101+
path.push(triple);
102+
}
96103
}
97104
path.push(dest);
98105
Layout::at(ws.config(), path)

0 commit comments

Comments
 (0)