File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff 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)
You can’t perform that action at this time.
0 commit comments