create util module & create join_config_path function

This commit is contained in:
ghassmo
2021-06-30 21:27:28 +03:00
parent e334d2ca2b
commit a19084ca10
2 changed files with 15 additions and 0 deletions

View File

@@ -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};

14
src/util.rs Normal file
View File

@@ -0,0 +1,14 @@
use crate::Error;
use crate::Result;
use std::path::PathBuf;
pub fn join_config_path(file: &PathBuf) -> Result<PathBuf> {
let mut path = dirs::home_dir()
.ok_or(Error::PathNotFound)?
.as_path()
.join(".config/darkfi/");
path.push(file);
Ok(path)
}