parameters_lib 0.2.2

Parameters Library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

use std::env::var_os;
use std::fs::write;
use std::path::Path;

fn main() {
    let content = format!(
r#"
const APP_NAME: &'static str = env!("CARGO_PKG_NAME");
const APP_VERSION: &'static str = env!("CARGO_PKG_VERSION");
"#);

    let out_dir = var_os("OUT_DIR").unwrap();
    let dest_path = Path::new(&out_dir).join("config.rs");
    write(&dest_path, content).unwrap();

    println!("cargo:rerun-if-changed=build.rs");
}