recursively create config directory too

This commit is contained in:
mat 2024-07-01 02:50:43 -05:00
parent 2fd44599e2
commit 45747ce53f

View File

@ -334,6 +334,9 @@ impl Config {
if !config_path.exists() { if !config_path.exists() {
info!("No config found, creating one at {config_path:?}"); info!("No config found, creating one at {config_path:?}");
let default_config_str = include_str!("../config-default.toml"); let default_config_str = include_str!("../config-default.toml");
if let Some(parent_path) = config_path.parent() {
let _ = fs::create_dir_all(parent_path);
}
fs::write(config_path, default_config_str)?; fs::write(config_path, default_config_str)?;
} }