Explicitly evaluate symlink on Windows (#2135)
This commit is contained in:
parent
fb9c934ef2
commit
b8c294bf4d
@ -137,14 +137,17 @@ fn maybe_add_protobuf_to_path() {
|
||||
if which::which("protoc").is_ok() {
|
||||
return;
|
||||
}
|
||||
let path = if cfg!(target_os = "windows") {
|
||||
let base = std::fs::read_link("../.bazel/out").unwrap();
|
||||
base.join("../external/protoc_bin_windows/bin/protoc.exe")
|
||||
} else {
|
||||
let base = Path::new("../.bazel/out/../external");
|
||||
let subpath = if cfg!(target_os = "windows") {
|
||||
"protoc_bin_windows/bin/protoc.exe"
|
||||
} else if cfg!(target_os = "macos") {
|
||||
let subpath = if cfg!(target_os = "macos") {
|
||||
"protoc_bin_macos/bin/protoc"
|
||||
} else {
|
||||
"protoc_bin_linux_x86_64/bin/protoc"
|
||||
};
|
||||
let path = base.join(subpath);
|
||||
base.join(subpath)
|
||||
};
|
||||
std::env::set_var("PROTOC", path.to_str().unwrap());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user