dfhack_proto_srcs/
lib.rs

1#![warn(missing_docs)]
2#![doc = include_str!("../README.md")]
3
4use std::path::PathBuf;
5
6/// Include directory when building the protobuf (protoc -I option)
7pub fn include_dir() -> &'static str {
8    let out_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/src/protos");
9    out_dir
10}
11
12/// List of extracted .proto files
13pub fn protos() -> Vec<PathBuf> {
14    let pattern = concat!(env!("CARGO_MANIFEST_DIR"), "/src/protos/*.proto");
15    let mut paths: Vec<PathBuf> = glob::glob(pattern).unwrap().map(|p| p.unwrap()).collect();
16    paths.sort();
17    paths
18}
19
20#[cfg(test)]
21mod tests {
22    use crate::protos;
23    #[test]
24    fn has_protos() {
25        assert!(protos().len() > 0)
26    }
27
28    #[test]
29    fn protos_exist() {
30        for proto in protos() {
31            assert!(proto.exists());
32        }
33    }
34}