From aeece24f620c83318050a1195fa16f21a4dd0bfb Mon Sep 17 00:00:00 2001 From: DenioD Date: Fri, 1 Nov 2019 15:38:06 +0100 Subject: [PATCH] fix create folder when not existent --- lib/src/lightclient.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/src/lightclient.rs b/lib/src/lightclient.rs index 265600a..bd443de 100644 --- a/lib/src/lightclient.rs +++ b/lib/src/lightclient.rs @@ -120,8 +120,15 @@ impl LightClientConfig { c => panic!("Unknown chain {}", c), }; } - - zcash_data_location.into_boxed_path() + + // Create directory if it doesn't exist + match std::fs::create_dir_all(zcash_data_location.clone()) { + Ok(_) => zcash_data_location.into_boxed_path(), + Err(e) => { + eprintln!("Couldn't create zcash directory!\n{}", e); + panic!("Couldn't create zcash directory!"); + } + } } pub fn get_wallet_path(&self) -> Box {