nimbus_fml/util/
mod.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2* License, v. 2.0. If a copy of the MPL was not distributed with this
3* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5use std::{env, path::PathBuf};
6
7pub mod loaders;
8
9pub(crate) fn pkg_dir() -> String {
10    env::var("CARGO_MANIFEST_DIR")
11        .expect("Missing $CARGO_MANIFEST_DIR, cannot build tests for generated bindings")
12}
13
14pub(crate) fn join(base: String, suffix: &str) -> String {
15    [base, suffix.to_string()]
16        .iter()
17        .collect::<PathBuf>()
18        .to_string_lossy()
19        .to_string()
20}
21
22// The Application Services directory
23#[allow(dead_code)]
24pub(crate) fn as_dir() -> String {
25    join(pkg_dir(), "../../..")
26}
27
28// The Nimbus SDK directory
29#[allow(dead_code)]
30pub(crate) fn sdk_dir() -> String {
31    join(as_dir(), "components/nimbus")
32}
33
34#[allow(dead_code)]
35pub(crate) fn build_dir() -> String {
36    join(pkg_dir(), "build")
37}
38
39#[allow(dead_code)]
40pub(crate) fn generated_src_dir() -> String {
41    join(build_dir(), "generated")
42}