Ensure config directory exists. (#1802)

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.
This commit is contained in:
Roman Borschel
2019-02-15 09:52:35 +01:00
committed by Bastian Köcher
parent 2acab71254
commit cf71350186
@@ -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) {