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 1
1
use pathdiff::diff_paths;
2
2
use rustc_data_structures::fx::FxHashSet;
3
- use std::env ;
3
+ use rustc_fs_util::try_canonicalize ;
4
4
use std::ffi::OsString;
5
- use std::fs;
6
5
use std::path::{Path, PathBuf};
7
6
8
7
pub struct RPathConfig<'a> {
@@ -82,12 +81,11 @@ fn get_rpath_relative_to_output(config: &mut RPathConfig<'_>, lib: &Path) -> OsS
82
81
// Mac doesn't appear to support $ORIGIN
83
82
let prefix = if config.is_like_osx { "@loader_path" } else { "$ORIGIN" };
84
83
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();
91
89
let relative = path_relative_from(&lib, &output)
92
90
.unwrap_or_else(|| panic!("couldn't create relative path from {output:?} to {lib:?}"));
93
91
You can’t perform that action at this time.
0 commit comments