1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// @generated by update-bin.sh
use std::path::Path;
use std::path::PathBuf;

fn cargo_manifest_dir() -> &'static Path {
    Path::new(env!("CARGO_MANIFEST_DIR"))
}

pub fn include_path() -> PathBuf {
    let include_path = cargo_manifest_dir().join("include");
    assert!(include_path.is_dir());
    include_path
}

/// Return a path to `protoc` binary for linux-x86_32.
pub fn protoc_bin_path() -> PathBuf {
    let protoc_bin_path = cargo_manifest_dir()
        .join("bin")
        .join("protoc");
    assert!(
        protoc_bin_path.exists(),
        "internal: protoc not found {}",
        protoc_bin_path.display(),
    );
    protoc_bin_path
}

#[cfg(test)]
mod test {
    use crate::include_path;
    use crate::protoc_bin_path;

    #[test]
    fn smoke() {
        assert!(include_path().exists());
        assert!(protoc_bin_path().exists());
    }
}