From 781931264738adb9e0738e795a7f08c7378edffa Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 21 Jan 2023 21:12:47 +0100 Subject: [PATCH] Fix initialization of config folder when reading config file --- src/repository/config.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/repository/config.rs b/src/repository/config.rs index f32c4d7..36db0a0 100644 --- a/src/repository/config.rs +++ b/src/repository/config.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; use thiserror::Error; use tokio::fs; -use crate::consts::{CFG_FILE_PATH, NODE_DIST_URL}; +use crate::consts::{CFG_DIR, CFG_FILE_PATH, NODE_DIST_URL}; use super::NodeVersion; @@ -53,6 +53,9 @@ impl Config { /// Loads the config file from the default config path pub async fn load() -> ConfigResult { if !CFG_FILE_PATH.exists() { + if !CFG_DIR.exists() { + fs::create_dir_all(&*CFG_DIR).await?; + } let cfg = Config::default(); cfg.save().await?;