Build using relative path in repo if Windows lost symlink

This commit is contained in:
David Tolnay
2021-04-09 14:15:58 -07:00
parent b53ebef438
commit dc4c31eb50
2 changed files with 14 additions and 1 deletions
+12
View File
@@ -0,0 +1,12 @@
use std::path::Path;
fn main() {
// Sometimes on Windows the git checkout does not correctly wire up the
// symlink from serde_derive_internals/src to serde_derive/src/internals.
// When this happens we'll just build based on relative paths within the git
// repo.
let mod_behind_symlink = Path::new("src/mod.rs");
if !mod_behind_symlink.exists() {
println!("cargo:rustc-cfg=serde_build_from_git");
}
}