use color_eyre::{
Section,
eyre::{Context, Result, eyre},
};
use std::path::PathBuf;
pub fn get_client_data_dir_path() -> Result<PathBuf> {
let mut home_dirs = dirs_next::data_dir()
.ok_or_else(|| eyre!("Failed to obtain data dir, your OS might not be supported."))?;
home_dirs.push("autonomi");
home_dirs.push("client");
std::fs::create_dir_all(home_dirs.as_path())
.wrap_err("Failed to create data dir")
.with_suggestion(|| {
format!(
"make sure you have the correct permissions to access the data dir: {home_dirs:?}"
)
})?;
Ok(home_dirs)
}