fix: Create data_dir if it does not exist
This commit is contained in:
parent
d2f2065042
commit
4bcb94ab27
@ -267,6 +267,9 @@ async fn init_dns_registrations(
|
|||||||
async fn write_registrations(registrations: &Registrations, config: &Config) {
|
async fn write_registrations(registrations: &Registrations, config: &Config) {
|
||||||
let path = config.data_dir.join("registrations.toml");
|
let path = config.data_dir.join("registrations.toml");
|
||||||
let contents = toml::to_string(registrations).unwrap();
|
let contents = toml::to_string(registrations).unwrap();
|
||||||
|
if !config.data_dir.exists() {
|
||||||
|
tokio::fs::create_dir_all(&config.data_dir).await.unwrap();
|
||||||
|
}
|
||||||
tokio::fs::write(path, contents).await.unwrap();
|
tokio::fs::write(path, contents).await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user