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
39
40
41
42
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use std::{env, path::PathBuf};

pub mod loaders;

pub(crate) fn pkg_dir() -> String {
    env::var("CARGO_MANIFEST_DIR")
        .expect("Missing $CARGO_MANIFEST_DIR, cannot build tests for generated bindings")
}

pub(crate) fn join(base: String, suffix: &str) -> String {
    [base, suffix.to_string()]
        .iter()
        .collect::<PathBuf>()
        .to_string_lossy()
        .to_string()
}

// The Application Services directory
#[allow(dead_code)]
pub(crate) fn as_dir() -> String {
    join(pkg_dir(), "../../..")
}

// The Nimbus SDK directory
#[allow(dead_code)]
pub(crate) fn sdk_dir() -> String {
    join(as_dir(), "components/nimbus")
}

#[allow(dead_code)]
pub(crate) fn build_dir() -> String {
    join(pkg_dir(), "build")
}

#[allow(dead_code)]
pub(crate) fn generated_src_dir() -> String {
    join(build_dir(), "generated")
}