From ebd121e8e4f8190c0ef94d31f7471e73f75847bf Mon Sep 17 00:00:00 2001 From: Bowen Wang Date: Thu, 24 Oct 2019 16:50:34 -0700 Subject: [PATCH] Fix keypair generation problem when directory does not exist --- genesis-tools/keypair-generator/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/genesis-tools/keypair-generator/src/main.rs b/genesis-tools/keypair-generator/src/main.rs index 4f7a11d2e80..4117cac27f8 100644 --- a/genesis-tools/keypair-generator/src/main.rs +++ b/genesis-tools/keypair-generator/src/main.rs @@ -1,6 +1,7 @@ use clap::{App, Arg, SubCommand}; use near::get_default_home; use near_crypto::{InMemorySigner, KeyType, SecretKey, Signer}; +use std::fs; use std::path::Path; fn main() { @@ -39,6 +40,7 @@ fn main() { .get_matches(); let home_dir = matches.value_of("home").map(|dir| Path::new(dir)).unwrap(); + fs::create_dir_all(home_dir).expect("Failed to create directory"); let account_id = matches.value_of("account-id"); let generate_config = matches.is_present("generate-config");