File tree 2 files changed +32
-1
lines changed 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -366,7 +366,8 @@ impl Config {
366
366
if let Some ( dir) = env:: var_os ( "CARGO_TARGET_DIR" ) {
367
367
* self . target_dir . borrow_mut ( ) = Some ( Filesystem :: new ( self . cwd . join ( dir) ) ) ;
368
368
} else if let Some ( val) = try!( self . get_path ( "build.target-dir" ) ) {
369
- * self . target_dir . borrow_mut ( ) = Some ( Filesystem :: new ( val. val ) ) ;
369
+ let val = self . cwd . join ( val. val ) ;
370
+ * self . target_dir . borrow_mut ( ) = Some ( Filesystem :: new ( val) ) ;
370
371
}
371
372
Ok ( ( ) )
372
373
}
Original file line number Diff line number Diff line change @@ -1892,3 +1892,33 @@ test!(non_utf8_output {
1892
1892
assert_that( p. cargo_process( "build" ) . arg( "-v" ) ,
1893
1893
execs( ) . with_status( 0 ) ) ;
1894
1894
} ) ;
1895
+
1896
+ test ! ( custom_target_dir {
1897
+ let p = project( "foo" )
1898
+ . file( "Cargo.toml" , r#"
1899
+ [project]
1900
+ name = "foo"
1901
+ version = "0.5.0"
1902
+ authors = []
1903
+
1904
+ [dependencies]
1905
+ a = { path = "a" }
1906
+ "# )
1907
+ . file( "src/lib.rs" , "" )
1908
+ . file( ".cargo/config" , r#"
1909
+ [build]
1910
+ target-dir = 'test'
1911
+ "# )
1912
+ . file( "a/Cargo.toml" , r#"
1913
+ [project]
1914
+ name = "a"
1915
+ version = "0.5.0"
1916
+ authors = []
1917
+ build = "build.rs"
1918
+ "# )
1919
+ . file( "a/build.rs" , "fn main() {}" )
1920
+ . file( "a/src/lib.rs" , "" ) ;
1921
+
1922
+ assert_that( p. cargo_process( "build" ) . arg( "-v" ) ,
1923
+ execs( ) . with_status( 0 ) ) ;
1924
+ } ) ;
You can’t perform that action at this time.
0 commit comments