try to fix libcsp-sys docs build

This commit is contained in:
Robin Müller 2024-06-01 20:27:41 +02:00
parent f1ec2158d9
commit 6cf745c316
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -15,19 +15,24 @@ fn main() {
println!("cargo:rustc-link-lib=csp"); println!("cargo:rustc-link-lib=csp");
} }
let out_path = env::var("OUT_DIR").unwrap(); let mut csp_conf_path = if std::env::var("DOCS_RS").is_ok() {
let csp_conf_dir = match env::var(ENV_KEY_CSP_CONFIG_DIR) { PathBuf::from("./templates")
Ok(conf_path) => conf_path, } else {
match env::var(ENV_KEY_CSP_CONFIG_DIR) {
Ok(conf_path) => conf_path.into(),
Err(_e) => { Err(_e) => {
println!( println!(
"cargo:warning={} not set, using CARGO_MANIFEST_DIR to search for autoconfig.rs", "cargo:warning={} not set, using CARGO_MANIFEST_DIR to search for autoconfig.rs",
ENV_KEY_CSP_CONFIG_DIR ENV_KEY_CSP_CONFIG_DIR
); );
env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set") env::var("CARGO_MANIFEST_DIR")
.expect("CARGO_MANIFEST_DIR not set")
.into()
}
} }
}; };
let mut csp_conf_path = PathBuf::new();
csp_conf_path.push(csp_conf_dir); let out_path = env::var("OUT_DIR").unwrap();
csp_conf_path.push("autoconfig.rs"); csp_conf_path.push("autoconfig.rs");
if !csp_conf_path.exists() { if !csp_conf_path.exists() {
panic!( panic!(