File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -86,13 +86,20 @@ impl Layout {
86
86
/// adding the target triple and the profile (debug, release, ...).
87
87
pub fn new ( ws : & Workspace , triple : Option < & str > , dest : & str ) -> CargoResult < Layout > {
88
88
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
90
90
// 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 .
92
92
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
+ }
96
103
}
97
104
path. push ( dest) ;
98
105
Layout :: at ( ws. config ( ) , path)
You can’t perform that action at this time.
0 commit comments