flatc_fork/
lib.rs

1//! Builds [flatbuffers] and provides the path to the built `flatc` in the
2//! public API. Typically meant to be used by build scripts, but can be useful
3//! otherwise if the project itself is using `flatc` during runtime.
4//!
5//! [flatbuffers]: https://github.com/google/flatbuffers
6
7/// Path of the built `flatc` executable.
8#[forbid(unsafe_code)]
9pub fn flatc() -> &'static std::path::Path {
10    if cfg!(windows) {
11        std::path::Path::new(concat!(env!("OUT_DIR"), "\\bin\\flatc.exe"))
12    } else {
13        std::path::Path::new(concat!(env!("OUT_DIR"), "/bin/flatc"))
14    }
15}
16
17#[test]
18fn flatc_exists() {
19    assert!(flatc().exists())
20}