File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
compiler/rustc_codegen_ssa/src/back Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 11use pathdiff:: diff_paths;
22use rustc_data_structures:: fx:: FxHashSet ;
3- use std:: env;
43use std:: ffi:: OsString ;
5- use std:: fs;
64use std:: path:: { Path , PathBuf } ;
75
86pub struct RPathConfig < ' a > {
@@ -82,12 +80,11 @@ fn get_rpath_relative_to_output(config: &mut RPathConfig<'_>, lib: &Path) -> OsS
8280 // Mac doesn't appear to support $ORIGIN
8381 let prefix = if config. is_like_osx { "@loader_path" } else { "$ORIGIN" } ;
8482
85- let cwd = env:: current_dir ( ) . unwrap ( ) ;
86- let mut lib = fs:: canonicalize ( & cwd. join ( lib) ) . unwrap_or_else ( |_| cwd. join ( lib) ) ;
87- lib. pop ( ) ; // strip filename
88- let mut output = cwd. join ( & config. out_filename ) ;
89- output. pop ( ) ; // strip filename
90- let output = fs:: canonicalize ( & output) . unwrap_or ( output) ;
83+ // Strip filenames
84+ let lib = lib. parent ( ) . unwrap ( ) ;
85+ let output = config. out_filename . parent ( ) . unwrap ( ) ;
86+ let lib = lib. canonicalize ( ) . unwrap ( ) ;
87+ let output = output. canonicalize ( ) . unwrap ( ) ;
9188 let relative = path_relative_from ( & lib, & output)
9289 . unwrap_or_else ( || panic ! ( "couldn't create relative path from {output:?} to {lib:?}" ) ) ;
9390
You can’t perform that action at this time.
0 commit comments