Ensure config directory exists.
Ensure the config directory exists before trying to write the public key file.
It is the responsibility of obtain_private_key to do so, as per the purpose
of this function.
@@ -42,6 +42,7 @@ pub fn obtain_private_key(
.map_err(|err| IoError::new(IoErrorKind::InvalidData, err))
} else {
if let Some(ref path) = net_config_path {
+ fs::create_dir_all(Path::new(path))?;
// Try fetch the key from a the file containing the secret.
let secret_path = Path::new(path).join(SECRET_FILE);
match load_private_key_from_file(&secret_path) {
