From af0e0b9b2bcc131804d5e940f94d45c6fef74481 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Fri, 1 Nov 2019 07:31:01 -0700 Subject: [PATCH] Create .zcash directory if it doesn't exist --- lib/src/lightclient.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/src/lightclient.rs b/lib/src/lightclient.rs index 1fd62a1..45de309 100644 --- a/lib/src/lightclient.rs +++ b/lib/src/lightclient.rs @@ -121,7 +121,14 @@ impl LightClientConfig { }; } - 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 {