affinidi_messaging_helpers/common/
mod.rs1use std::{env, error::Error};
2
3pub mod affinidi_logo;
4pub mod did;
5
6pub fn check_path() -> Result<bool, Box<dyn Error>> {
9 let cwd = std::env::current_dir()?;
10 let mut path = String::new();
11 let mut found = false;
12 cwd.components().rev().for_each(|dir| {
13 if dir.as_os_str() == "affinidi-messaging" && !found {
14 found = true;
15 path.push_str("./");
16 } else if !found {
17 path.push_str("../");
18 }
19 });
20
21 if !found {
22 return Err("You are not in the affinidi-messaging repository".into());
23 }
24
25 env::set_current_dir(&path)?;
26
27 Ok(true)
28}