Skip to content

Commit

Permalink
fix: make config file if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanabx committed Apr 27, 2024
1 parent b70f5e1 commit 7b94b62
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clap::Parser;
use server::ServerError;
use std::{env, io};
use std::{env, fs, io};

use std::{fs::read_to_string, path::Path};

Expand Down Expand Up @@ -177,14 +177,7 @@ async fn main() -> Result<(), Error> {
match conf_path.try_exists() {
Ok(false) | Err(_) => {
log::error!("Cannot find config at '{:?}'", conf_path);
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
format!(
"Config path does not exist. Consider creating a config at '{:?}'",
conf_path
),
)
.into());
let _ = fs::write(conf_path, "");
}
_ => {}
}
Expand Down

0 comments on commit 7b94b62

Please sign in to comment.