File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
compiler/rustc_codegen_ssa/src/back Expand file tree Collapse file tree 1 file changed +6
-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 ;
3+ use rustc_fs_util :: try_canonicalize ;
44use std:: ffi:: OsString ;
5- use std:: fs;
65use std:: path:: { Path , PathBuf } ;
76
87pub struct RPathConfig < ' a > {
@@ -82,12 +81,11 @@ fn get_rpath_relative_to_output(config: &mut RPathConfig<'_>, lib: &Path) -> OsS
8281 // Mac doesn't appear to support $ORIGIN
8382 let prefix = if config. is_like_osx { "@loader_path" } else { "$ORIGIN" } ;
8483
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) ;
84+ // Strip filenames
85+ let lib = lib. parent ( ) . unwrap ( ) ;
86+ let output = config. out_filename . parent ( ) . unwrap ( ) ;
87+ let lib = try_canonicalize ( lib) . unwrap ( ) ;
88+ let output = try_canonicalize ( output) . unwrap ( ) ;
9189 let relative = path_relative_from ( & lib, & output)
9290 . unwrap_or_else ( || panic ! ( "couldn't create relative path from {output:?} to {lib:?}" ) ) ;
9391
You can’t perform that action at this time.
0 commit comments