cuprate_helper::fs

Function address_book_path

Source
pub fn address_book_path(cache_dir: &Path, network: Network) -> PathBuf
Expand description

Cuprate’s address-book directory.

This is the PATH used for any Cuprate address-book files.

use cuprate_helper::{network::Network, fs::{CUPRATE_CACHE_DIR, address_book_path}};

assert_eq!(address_book_path(&**CUPRATE_CACHE_DIR, Network::Mainnet).as_path(), CUPRATE_CACHE_DIR.join("addressbook"));
assert_eq!(address_book_path(&**CUPRATE_CACHE_DIR, Network::Stagenet).as_path(), CUPRATE_CACHE_DIR.join(Network::Stagenet.to_string()).join("addressbook"));
assert_eq!(address_book_path(&**CUPRATE_CACHE_DIR, Network::Testnet).as_path(), CUPRATE_CACHE_DIR.join(Network::Testnet.to_string()).join("addressbook"));