Skip to content

Commit 6867d64

Browse files
committed
add helper to target bin path
1 parent eb1a5c9 commit 6867d64

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler/rustc_session/src/filesearch.rs

+8
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ pub fn make_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf {
5151
PathBuf::from_iter([sysroot, Path::new(&rustlib_path), Path::new("lib")])
5252
}
5353

54+
/// Returns a path to the target's `bin` folder within its `rustlib` path in the sysroot. This is
55+
/// where binaries are usually installed, e.g. the self-contained linkers, lld-wrappers, LLVM tools,
56+
/// etc.
57+
pub fn make_target_bin_path(sysroot: &Path, target_triple: &str) -> PathBuf {
58+
let rustlib_path = rustc_target::target_rustlib_path(sysroot, target_triple);
59+
PathBuf::from_iter([sysroot, Path::new(&rustlib_path), Path::new("bin")])
60+
}
61+
5462
#[cfg(unix)]
5563
fn current_dll_path() -> Result<PathBuf, String> {
5664
use std::ffi::{CStr, OsStr};

0 commit comments

Comments
 (0)