diff --git a/src/lib.rs b/src/lib.rs index a3fe26fb4..981a40826 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,6 +21,7 @@ pub mod tx; pub mod vm; pub mod vm_serial; pub mod wallet; +pub mod util; pub use crate::bls_extensions::BlsStringConversion; pub use crate::error::{Error, Result}; diff --git a/src/util.rs b/src/util.rs new file mode 100644 index 000000000..230d4f230 --- /dev/null +++ b/src/util.rs @@ -0,0 +1,14 @@ + +use crate::Error; +use crate::Result; + +use std::path::PathBuf; + +pub fn join_config_path(file: &PathBuf) -> Result { + let mut path = dirs::home_dir() + .ok_or(Error::PathNotFound)? + .as_path() + .join(".config/darkfi/"); + path.push(file); + Ok(path) +}