use clap::ArgMatches; use std::fs::create_dir_all; use std::path::{Path, PathBuf}; pub fn ensure_dir_exists>(path: P) -> Result<(), String> { let path = path.as_ref(); if !path.exists() { create_dir_all(path).map_err(|e| format!("Unable to create {:?}: {:?}", path, e))?; } Ok(()) } pub fn base_wallet_dir(matches: &ArgMatches, arg: &'static str) -> Result { clap_utils::parse_path_with_default_in_home_dir( matches, arg, PathBuf::new().join(".lighthouse").join("wallets"), ) }