1
Fork 0
rust/compiler/rustc_codegen_gcc/build_system/src/rustc_info.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
370 B
Rust
Raw Normal View History

2023-08-18 16:06:20 +02:00
use std::path::{Path, PathBuf};
use crate::utils::run_command;
pub fn get_rustc_path() -> Option<PathBuf> {
if let Ok(rustc) = std::env::var("RUSTC") {
return Some(PathBuf::from(rustc));
}
run_command(&[&"rustup", &"which", &"rustc"], None)
.ok()
2023-10-04 16:01:02 +02:00
.map(|out| Path::new(String::from_utf8(out.stdout).unwrap().trim()).to_path_buf())
2023-08-18 16:06:20 +02:00
}