@@ -19,7 +19,6 @@ extern crate cargo_build_script_output_parser;
19
19
use cargo_build_script_output_parser:: { BuildScriptOutput , CompileAndLinkFlags } ;
20
20
use std:: collections:: BTreeMap ;
21
21
use std:: env;
22
- use std:: ffi:: OsString ;
23
22
use std:: fs:: { create_dir_all, read_to_string, write} ;
24
23
use std:: path:: Path ;
25
24
use std:: process:: Command ;
@@ -90,10 +89,10 @@ fn run_buildrs() -> Result<(), String> {
90
89
}
91
90
92
91
if let Some ( cc_path) = env:: var_os ( "CC" ) {
93
- let mut cc_path = absolutify ( & exec_root, cc_path) ;
92
+ let mut cc_path = exec_root. join ( cc_path) ;
94
93
if let Some ( sysroot_path) = env:: var_os ( "SYSROOT" ) {
95
94
cc_path. push ( " --sysroot=" ) ;
96
- cc_path. push ( absolutify ( & exec_root, sysroot_path) ) ;
95
+ cc_path. push ( & exec_root. join ( sysroot_path) ) ;
97
96
}
98
97
command. env ( "CC" , cc_path) ;
99
98
}
@@ -105,7 +104,7 @@ fn run_buildrs() -> Result<(), String> {
105
104
if Path :: new ( & ar_path) . file_name ( ) == Some ( "libtool" . as_ref ( ) ) {
106
105
command. env_remove ( "AR" ) ;
107
106
} else {
108
- command. env ( "AR" , absolutify ( & exec_root, ar_path) ) ;
107
+ command. env ( "AR" , exec_root. join ( ar_path) ) ;
109
108
}
110
109
}
111
110
@@ -258,15 +257,6 @@ fn get_target_env_vars<P: AsRef<Path>>(rustc: &P) -> Result<BTreeMap<String, Str
258
257
. collect ( ) )
259
258
}
260
259
261
- fn absolutify ( root : & Path , maybe_relative : OsString ) -> OsString {
262
- let path = Path :: new ( & maybe_relative) ;
263
- if path. is_relative ( ) {
264
- root. join ( path) . into_os_string ( )
265
- } else {
266
- maybe_relative
267
- }
268
- }
269
-
270
260
fn main ( ) {
271
261
std:: process:: exit ( match run_buildrs ( ) {
272
262
Ok ( _) => 0 ,
0 commit comments