We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f92ce2e commit 1e9595eCopy full SHA for 1e9595e
src/build_helper/lib.rs
@@ -43,10 +43,16 @@ pub fn cc2ar(cc: &Path, target: &str) -> PathBuf {
43
if target.contains("musl") || target.contains("msvc") {
44
PathBuf::from("ar")
45
} else {
46
+ let parent = cc.parent().unwrap();
47
let file = cc.file_name().unwrap().to_str().unwrap();
- cc.parent().unwrap().join(file.replace("gcc", "ar")
48
- .replace("cc", "ar")
49
- .replace("clang", "ar"))
+ for suffix in &["gcc", "cc", "clang"] {
+ if let Some(idx) = file.rfind(suffix) {
50
+ let mut file = file[..idx].to_owned();
51
+ file.push_str(suffix);
52
+ return parent.join(&file);
53
+ }
54
55
+ parent.join(file)
56
}
57
58
0 commit comments