Refactor the build script

This commit is contained in:
Rodolphe Bréard 2023-03-27 22:46:50 +02:00
parent 9821a9888e
commit d9eecf1f5f

View file

@ -1,9 +1,13 @@
use std::env;
const DEFAULT_VARLIBDIR: &str = "/var/lib/";
const VARLIBDIR_NAME: &str = "VARLIBDIR";
const VARLIBDIR_VALUE_DEFAULT: &str = "/var/lib/";
fn main() {
if let Err(_) = env::var("VARLIBDIR") {
println!("cargo:rustc-env={}={}", "VARLIBDIR", DEFAULT_VARLIBDIR);
if env::var(VARLIBDIR_NAME).is_err() {
println!(
"cargo:rustc-env={}={}",
VARLIBDIR_NAME, VARLIBDIR_VALUE_DEFAULT
);
}
}