Only create config-directory on init success

We should only create the file if the user finished the initial setup correctly.
This commit is contained in:
Daniel Karzel 2021-05-07 12:06:03 +10:00
parent d96e20a5b0
commit 538b25a6dd
No known key found for this signature in database
GPG Key ID: 30C3FC2E438ADB6E

View File

@ -123,10 +123,11 @@ where
F: Fn() -> Result<Config>,
{
info!("Config file not found, running initial setup...");
ensure_directory_exists(config_path.as_path())?;
let initial_config = config_file()?;
let toml = toml::to_string(&initial_config)?;
ensure_directory_exists(config_path.as_path())?;
fs::write(&config_path, toml)?;
info!(