summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/config.rs4
-rw-r--r--src/error.rs2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs
index 369a505..8db16bb 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -67,6 +67,10 @@ impl Config {
let path = Self::config_file_path();
if !path.try_exists()? {
+ let _ = fs::File::create(path)
+ .await
+ .expect("expected permissions to create config file");
+
return Err(Error::ConfigMissing);
}
diff --git a/src/error.rs b/src/error.rs
index c8405f4..a65fb54 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -8,7 +8,7 @@ use thiserror::Error;
#[error(transparent)]
pub enum Error {
IO(Arc<io::Error>),
- #[error("Config does not exist")]
+ #[error("Config file does not exist, so an empty one was created")]
ConfigMissing,
#[error("JSON parsing error: {0}")]
SerdeJSON(Arc<serde_json::Error>),